Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how i i execute a stored procedure from sql*plus which gives a r

Status
Not open for further replies.

2314

Programmer
May 19, 2001
69
IN
how i i execute a stored procedure from sql*plus which gives a return value
 
Is it a procedure or a function? If a function, you could try

Code:
set serveroutput on

declare
  x varchar2(255); -- or whatever your return type is
begin
  x := your_function;
  dbms_output.put_line(x);
END;
/

If the code is a procedure with an OUT parameter, change the first line of code to

[tt]your_function(x);[/tt]


...although I'm sure theres a more elegant solution.
 
Or

Code:
VAR result VARCHAR2(4000)
EXEC :result := function(parameters)
PRINT result

Or if your function doesn't modify database just:

Code:
  select function(parameters) from dual;

BTW in Oracle and many other languages procedure returning a value is called function.

Regards, Dima
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top