BookmarkSubscribeRSS Feed
itchyeyeballs
Pyrite | Level 9

Hi All,

 

Can anyone help me with the syntax to execute a simple stored procedure within an EG process flow?

I've seen a guide here - https://amadeus.co.uk/sas-tips/executing-sql-stored-procedures-using-proc-sql/ but would rather not include the log in details in the code.

 

I can run procsql using syntax like:

 

proc sql;
create table SqlserverLibrary.table as
select * from desktop1.all;
quit;

 

But I can't seem to execute a simple stored procedure in the same way. There are no parameters, the procedure simply drops some temp tables and recreates them with updated versions.

 

Any help appreciated

4 REPLIES 4
LinusH
Tourmaline | Level 20

You need to do it in an explicit SQL pass through, by using either select * from connection to...() or execute () by...

There have been several posts about this on the communities, your should be able to find it by doing a serach.

Data never sleeps
itchyeyeballs
Pyrite | Level 9

Thank  you,

 

I always try searching before posting but didn't spot anything useful, guess I wasn't using right terms so will give it another go using your hints.

 

I've gotten it working now using :

 

PROC SQL;
	Connect to odbc (datasrc=dbdsn user = user password = password);
		Execute(db.stored_proc) by odbc;
	Disconnect from odbc;
QUIT;

but I really don't like having the username and password in plain text

 

however I've managed to find

proc pwencode

which gets around the issue

 

(I'd still prefer to use the server authentication as I do when connecting to a library though)

andystad
Calcite | Level 5

I am using the below code to execute a stored procedur but for the chanegs to show in the databse dont i need to commit them? if so can you do that from SAS?


proc sql;
connect to oracle (user='username' password=password path="path" );
execute (stored_proc) by oracle;
disconnect from oracle;
quit;

itchyeyeballs
Pyrite | Level 9

If your not using transactions you shouldn't need to commit (although may depend on settings)

 

Some info here - https://dba.stackexchange.com/questions/84769/commit-and-rollback-in-oracle-stored-procedure

 

 

 

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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