Home » SQL & PL/SQL » SQL & PL/SQL » calling another procedure in a stored procedure (Oracle 9)
calling another procedure in a stored procedure [message #376186] Tue, 16 December 2008 07:51 Go to next message
shaksing
Messages: 115
Registered: November 2008
Senior Member
I want to call a stored procedure (p2) inside another stored procedure (p1) , passing one input parameter(i1) in p2.

EXECUTE IMMEDIATE 'call COMPACTAR_TABLA ( master_table )';


I tried this one but its not working.

If i dont want to use dynamic query than how can i call the stored procedure.

Re: calling another procedure in a stored procedure [message #376189 is a reply to message #376186] Tue, 16 December 2008 07:55 Go to previous messageGo to next message
joy_division
Messages: 4963
Registered: February 2005
Location: East Coast USA
Senior Member
procedure_name(parameter);


QED
Re: calling another procedure in a stored procedure [message #376190 is a reply to message #376186] Tue, 16 December 2008 07:55 Go to previous messageGo to next message
avik2009
Messages: 61
Registered: November 2008
Member
Instead of
EXECUTE IMMEDIATE 'call COMPACTAR_TABLA ( master_table )';

COMPACTAR_TABLA ( master_table ); 
will work
Re: calling another procedure in a stored procedure [message #376191 is a reply to message #376186] Tue, 16 December 2008 07:57 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
Just call it exacly like you would from an anonymous Pl/SQl block.
Here's an examply showing procedure p1 calling procedure p2 and passing a parameter:
CREATE OR REPLACE PROOCEDURE p2 (p_1     in varchar2) AS
BEGIN
  dbms_output.put_line(p_1);
END;
/

CREATE OR REPPLACE PROCEDURE p1 (param_1 in varchar2
                                ,param_2 number) AS
BEGIN
  p2(param_1||param_2);
END;
/
  
Re: calling another procedure in a stored procedure [message #376199 is a reply to message #376186] Tue, 16 December 2008 08:15 Go to previous message
shaksing
Messages: 115
Registered: November 2008
Senior Member
Done.

Thanks a lot.
Previous Topic: alter index problem
Next Topic: dbms_output.put_line
Goto Forum:
  


Current Time: Tue Dec 03 12:56:05 CST 2024