Crubal Chenxi Li
Crubal Chenxi Li

Reputation: 313

Oracle and SAS connection grammar

I have a question when using SAS, and connected it to an Oracle database:

proc sql;
connect to oracle (user=xxxxx orapw=xxxxx path=xxxx);

create table pt as
select * 
from connection to oracle
(

);

disconnect from oracle;

quit; 

Within the ( ), I typed in SQL code, but should that all follow SQL grammar, or follow SAS grammar?

Upvotes: 1

Views: 207

Answers (1)

Quentin
Quentin

Reputation: 6378

Within the () your code should be Oracle SQL code. What you have written is an explicit pass-through query. The SQL code within the parentheses is passed to Oracle and will execute there. The results of the query will then be sent back to SAS and will become the PT table.

If you were to submit code that included SAS-specific language (e.g. data step code or even SQL that used SAS-specific functions), you would get back an error because Oracle would not understand it.

Upvotes: 3

Related Questions