BookmarkSubscribeRSS Feed
chittamsri1_gmail_com
Calcite | Level 5

What is the Code We Use to Connect to Oracle Database from SAS In Unix Environment & Windowing Environment

PLease give me the reply

* i have all the information in oracle database .I want to get that information from oracle database and i want to work in SAS ENVIRONMENT .Please tell me the code for this .

4 REPLIES 4
RW9
Diamond | Level 26 RW9
Diamond | Level 26

You need to have the connection information, then you can either do it directly or through pass through:

Directly:

proc sql;

     connect to oracle (path=dddd user=aaa orapw=cccc);

     create table work.test as

     select * from connection to oracle (

          select...

           from...

          );

     disconnect from oracle;

quit;

Pass-through:

proc sql;

     connect to oracle (path=dddd user=aaa orapw=cccc);

     execute (drop table A_TABLE) by oracle;

     execute (commit) by oracle;

     disconnect from oracle;

quit;

LinusH
Tourmaline | Level 20

Just to be clear about the concepts. Both these examples are usually defined as Explicit SQL Pass-thru - you explicitly write native DBMS specific SQL.

You can use SAS programs to access a libref that points to DBMS schema. The part of the SAS logic that the SAS/ACCESS libname engine can transform to native DBMS SQL will be automatically sent to the DBMS for processing. This is true for both SAS SQL, PROC's and Data step, in the later mainly WHERE-clauses. This is known as Implicit SQL pass-thru.

Data never sleeps

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1397 views
  • 0 likes
  • 3 in conversation