Home » SQL & PL/SQL » SQL & PL/SQL » Can I call a stored procedure through a select query (Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production)
Can I call a stored procedure through a select query [message #627264] Mon, 10 November 2014 04:25 Go to next message
queeny
Messages: 20
Registered: July 2011
Location: india
Junior Member
Hi,

How to call a stored procedure inside a select query.

I have procedure with two input and two ouput parametres.

I am trying with a select query like

select out1,out2 from proc('x','y',out1,out2);

Can anyone share the syntax.
Re: Can I call a stored procedure through a select query [message #627266 is a reply to message #627264] Mon, 10 November 2014 04:34 Go to previous messageGo to next message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Quote:
How to call a stored procedure inside a select query.


You can't.

Re: Can I call a stored procedure through a select query [message #627279 is a reply to message #627266] Mon, 10 November 2014 08:36 Go to previous messageGo to next message
Lalit Kumar B
Messages: 3174
Registered: May 2013
Location: World Wide on the Web
Senior Member
@OP, perhaps you can tell us what happened when you tried to do so.

Are you trying to get the values of OUT parameter in a PL/SQL code or directly executing the SQL as you have shown above.
Re: Can I call a stored procedure through a select query [message #627294 is a reply to message #627279] Mon, 10 November 2014 14:16 Go to previous messageGo to next message
Bill B
Messages: 1971
Registered: December 2004
Senior Member
since you never said what data types out1 and out2 are, I will assume they are character of a maximum length of 10.
declare
out1   varchar2(10);
out2   varchar2(10);
begin
  proc('x','y',out1,out2);
  dbms_output.put_line(out1||'/'||out2);
end;
Re: Can I call a stored procedure through a select query [message #627297 is a reply to message #627294] Mon, 10 November 2014 14:19 Go to previous messageGo to next message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

This is not "through a select query", is it?

Re: Can I call a stored procedure through a select query [message #627382 is a reply to message #627297] Tue, 11 November 2014 08:21 Go to previous messageGo to next message
queeny
Messages: 20
Registered: July 2011
Location: india
Junior Member
Yeah this is not throught Select query right?
Re: Can I call a stored procedure through a select query [message #627415 is a reply to message #627382] Tue, 11 November 2014 13:41 Go to previous message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
Right. You can't call procedures within SQL statements (select, insert, update, delete), you can call functions in SQL statements,
Previous Topic: Long and Clob Problem
Next Topic: date validation
Goto Forum:
  


Current Time: Thu Apr 25 20:30:19 CDT 2024