0
votes

I have maked an stored procedure but I cannot execute the stored procedure I dont know what the problem is.

Source code:

Create or replace procedure land_naam(klantnummer_input in VARCHAR2
, verzendland_output out VARCHAR2)

AS 

BEGIN

SELECT land into verzendland_output from klanten 

WHERE klantnummer = klantnummer_input;

END land_naam;

First I create the procedure without any error.

Then if I want to execute it I run the code

Execute land_naam;

after that I get the error :

ORA-00900: invalid SQL statement

What can i do to solve this problem? The procedure The error statement

2
from what I can tell, you're specifying klantnummer_input as an input parameter. You have to pass a value for it Execute land_naam(some_input_value) - Daniel Farrell
What do you think (klantnummer_input in VARCHAR2 , verzendland_output out VARCHAR2) mean? - Ken White
Still getting the same error If I pass value for it I tryed execute land_naam('S'); - Samet Selvi

2 Answers

0
votes

Modify your code to something like this:

Create or replace procedure land_naam(klantnummer_input in VARCHAR2)
AS 
verzendland_output VARCHAR2(2000);
BEGIN
SELECT land into verzendland_output from klanten 
WHERE klantnummer = klantnummer_input;
END land_naam;

When executing the procedure, since you have an input parameter, provide one.

e.g. EXECUTE land_naam('S');
0
votes

As your procedure is specifying both an input and an output parameter, you'll have to specify those when calling your procedure:

To declare a variable in SQLPlus that will hold the output, simple use

SQL> var out varchar2(100)

Then call the stored procedure with an input and output parameter (otherwise you're not specifying the correct number of parameters)

SQL> exec land_naam('yourinput', :out)

Finally, print out the contents of your output variable

SQL> print out