1

I have a stored procedure which does the select statement. I have created another stored procedure which calls the earlier stored procedure,but enable to get the result. Below are the scripts

Proc1:

create or replace
PROCEDURE p_procedure3(custid IN number, custname OUT varchar2) IS
BEGIN

SELECT firstname 
INTO custname
FROM customer_s
WHERE customerid = custid;

END p_procedure3;

proc2:

create or replace
procedure finalexecution
DECLARE
l_name varchar2(20);
BEGIN

p_procedure3(644, l_name);

dbms_output.put_line(l_name);

END;

but when is do exex finalexecution;

getting below error

Error starting at line 8 in command:
exec finalexecution
Error report:
ORA-06550: line 1, column 7:
PLS-00905: object CIMNEWUSER.FINALEXECUTION is invalid
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
06550. 00000 -  "line %s, column %s:\n%s"
*Cause:    Usually a PL/SQL compilation error.
*Action:
Devart
  • 119,203
  • 23
  • 166
  • 186
mahesh
  • 274
  • 2
  • 4
  • 20

2 Answers2

2

Your finalexecution procedure contains error. You should use IS or AS instead of DECLARE. Check documentaion for more details.

Also in case if any error, you can check all_errors view to find out what is causing the error.

Noel
  • 10,152
  • 30
  • 45
  • 67
  • issue is solved. now next thing is i want to retrieve multiple rows i have written that script please find it below,i know somewhere i have to go with loop but unable to do that please guide me below is the script which gives me result for the last id – mahesh Jun 25 '13 at 07:18
1

Change the second procedure to:

create or replace
procedure finalexecution as
  l_name varchar2(20):='';
BEGIN
  p_procedure3(644, l_name);
  dbms_output.put_line(l_name);
END;

For more details, refer Call a stored procedure with another in Oracle

Community
  • 1
  • 1
TechDo
  • 18,398
  • 3
  • 51
  • 64