Hybrid Queries (from Fraktal SAS Programming): Unterschied zwischen den Versionen

Aus phenixxenia.org
Zur Navigation springen Zur Suche springen
K
K
Zeile 1: Zeile 1:
 
[[Kategorie:Zazy]]
 
[[Kategorie:Zazy]]
  
;1st Make SAS your SQL interpreter
+
{| class="wikitable"
 
+
|-
 +
! Code executed
 +
! Function performed
 +
|-
 +
|
 
  proc sql;
 
  proc sql;
 
+
| '''Start the SQL interpreter inside SAS'''
;2nd Connect to the DBMS using your credentials stored in [[Macro Variables]]
+
|-
 
+
|
 
  connect to oracle (user="&DB_USR." password="&DB_PWD." path="&DB_PTH.");
 
  connect to oracle (user="&DB_USR." password="&DB_PWD." path="&DB_PTH.");
 
+
| '''Open connection to the DBMS using your credentials stored in [[Macro Variables]]'''
;3rd Start your query from inside SAS with a special from clause
+
|-
 
+
 
  select *  
 
  select *  
 
   from connection to oracle
 
   from connection to oracle
 
+
| '''Start your query from inside SAS with a special from clause'''
;4th Inside brackets use DBMS specific SQL
+
|-
 
+
|
 
  (
 
  (
 
  select *  
 
  select *  
 
   from ops$&DB_USR..&MYTABLE.
 
   from ops$&DB_USR..&MYTABLE.
 
  )
 
  )
 
+
| '''Inside brackets use DBMS specific SQL'''
;5th Execute the query by issuing the SAS statement terminator ';'
+
|-
 
+
|
 
  ;
 
  ;
 
+
| '''Execute the query by issuing the SAS statement terminator ';''''
;6th Terminate connection to DBMS
+
|-
 
+
|
  disconnect to oracle;
+
  disconnect from oracle;
 
+
| '''Close connection to DBMS'''
;7th Terminate SAS SQL processor status
+
|-
 
+
|
 
  quit;
 
  quit;
 +
| '''Terminate SAS SQL processor status'''
 +
|}

Version vom 19. Juni 2014, 11:01 Uhr


Code executed Function performed
proc sql;
Start the SQL interpreter inside SAS
connect to oracle (user="&DB_USR." password="&DB_PWD." path="&DB_PTH.");
Open connection to the DBMS using your credentials stored in Macro Variables
select * 
  from connection to oracle
Start your query from inside SAS with a special from clause
(
select * 
  from ops$&DB_USR..&MYTABLE.
)
Inside brackets use DBMS specific SQL
;
Execute the query by issuing the SAS statement terminator ';'
disconnect from oracle;
Close connection to DBMS
quit;
Terminate SAS SQL processor status