BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
higorcc
Fluorite | Level 6

Hello,

I would like to know, how can I execute Oracle Store Procedure with OUTPUT variable in SAS GUIDE.

 

In Sql Developer I can execute like you can see below and it works.

 

Oracle Code:

VAR OUTPUT1 NUMBER;
VAR OUTPUT2 NUMBER;

EXECUTE StoredProcedure(99, :OUTPUT1, :OUTPUT2);

 

When I declare VAR OUTPUT NUMBER in PROC SQL it doesn't work.

Could you please help me with an alternative way to execute this?

 

Thank you.

Higor Carvalho.

1 ACCEPTED SOLUTION

Accepted Solutions
higorcc
Fluorite | Level 6

Hello,

The solution is:

 

Oracle Code:
DECLARE
OUTPUT1 NUMBER;
OUTPUT2 NUMBER;

BEGIN
          StoredProcedure(99, OUTPUT1, OUTPUT2);
END
;

 

I solved my issue by above code.

You need execute this code in PROC SQL.

 

Thank you.

Higor Carvalho.

View solution in original post

5 REPLIES 5
Tom
Super User Tom
Super User

@higorcc wrote:

Hello,

I would like to know, how can I execute Oracle Store Procedure with OUTPUT variable in SAS GUIDE.

 

In Sql Developer I can execute like you can see below and it works.

 

Oracle Code:

VAR OUTPUT1 NUMBER;
VAR OUTPUT2 NUMBER;

EXECUTE StoredProcedure(99, :OUTPUT1, :OUTPUT2);

 

When I declare VAR OUTPUT NUMBER in PROC SQL it doesn't work.

Could you please help me with an alternative way to execute this?

 

Thank you.

Higor Carvalho.


I am not sure what those two "output" thingys have to do with your problem.

It looks like you have a procedure named STOREDPROCEDURE() that takes as input 3 numbers.

So why not just do that. 

What numbers you want to pass in as the last two arguments to the procedure?

 

 

higorcc
Fluorite | Level 6

In this case I have a stored procedure with 1 IN (Input) and 2 OUT (output).

 

For 2 OUT (output) when I execute I need declare these two "output".

 

In Sql Developer I declare this code and it works, but when I put the same code in PROC SQL with Oracle Connection it doesn't work.

 

Thank you.

Higor Carvalho.

Tom
Super User Tom
Super User

@higorcc wrote:

In this case I have a stored procedure with 1 IN (Input) and 2 OUT (output).

 

For 2 OUT (output) when I execute I need declare these two "output".

 

In Sql Developer I declare this code and it works, but when I put the same code in PROC SQL with Oracle Connection it doesn't work.

 

Thank you.

Higor Carvalho.


How can you tell it did not work?  It looks to me like you are writing output to symbols and not into an actual table that you can query.  Why not add a step to store those temporary symbols into a table so you can then query the table to get the results back to SAS?

SASKiwi
PROC Star

Please post your SAS log including the complete code and any notes and errors.

higorcc
Fluorite | Level 6

Hello,

The solution is:

 

Oracle Code:
DECLARE
OUTPUT1 NUMBER;
OUTPUT2 NUMBER;

BEGIN
          StoredProcedure(99, OUTPUT1, OUTPUT2);
END
;

 

I solved my issue by above code.

You need execute this code in PROC SQL.

 

Thank you.

Higor Carvalho.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 5 replies
  • 760 views
  • 0 likes
  • 3 in conversation