Invoking a stored procedure in a select statement
How to invoke a stored procedure in a select statement?
You cannot invoke a stored procedure in a SELECT statement. However, you can call a function in a SELECT statement. The function can be a wrapper for the stored procedure. For instance, assume that I have a stored procedure called FOO. Let's create a wrapper function BAR that calls the stored proc:
CREATE FUNCTION bar () RETURN number AS BEGIN foo(); RETURN 1; END; /
Now I can use the function above to execute the stored proc in my SELECT statement:
SELECT bar() FROM dual;