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
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');
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.