Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:

The stored procedure is getting compiled successfully but receiving error when trying to execute it

Code to create stored procedure:


CREATE OR REPLACE PROCEDURE spGetTreeViewItems1
(p_spGetTreeViewItems OUT SYS_REFCURSOR, firstParam string)
is
Begin
open p_spGetTreeViewItems for
Select * from TREEVIEW;
End spGetTreeViewItems1;


Execution:

Try 1:

set serveroutput on;
variable rc refcursor, fn fstname
exec spGetTreeViewItems1( :rc );
print rc, fn;

Try 2:
execute spGetTreeViewItems1;


What I have tried:

I'm trying to compile and execute the stored procedure
Posted
Updated 7-Aug-18 7:19am

1 solution

You've declared a stored procedure which takes two parameters.

You're trying to call it passing in one parameter.

Your second attempt tries to call it passing zero parameters.

The error message is correct: you are passing the wrong number of arguments.
 
Share this answer
 
v2
Comments
Sravani N 8-Aug-18 5:14am    
Thank You Richard for responding on my question.
Can you please help me how to call procedure passing 2 parameters in my code?
Richard Deeming 8-Aug-18 6:14am    
I'm not overly familiar with Oracle, but at a guess, something like this:
exec spGetTreeViewItems1( :rc, :fn );
Sravani N 8-Aug-18 12:09pm    
It is giving me below error

Bind variable "fn" is not declared
anonymous block completed
Sravani N 9-Aug-18 8:00am    
Can someone please help me to execute my stored procedure with 2 parameters
Richard Deeming 9-Aug-18 9:08am    
set serveroutput on;
variable rc refcursor, fn string;
exec spGetTreeViewItems1( :rc, :fn );
print rc, fn;

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900