DeaIss
DeaIss

Reputation: 2585

Why does this SQL stored procedure not work?

This is the procedure:

create or replace
PROCEDURE INSERTUSER(
       username IN USERS.USERNAME%TYPE,
     password IN USERS.PASSWORD%TYPE,
       firstname IN USERS.FIRSTNAME%TYPE,
       lastname IN USERS.LASTNAME%TYPE,
     role IN USERS.ROLE%TYPE,
     banstatus IN USERS.BANSTATUS%TYPE,
     verifystatus IN USERS.VERIFYSTATUS%TYPE)
AS
BEGIN

  INSERT INTO USERS ("USERNAME", "PASSWORD", "FIRSTNAME", "LASTNAME", "ROLE", "BANSTATUS", "VERIFYSTATUS") 
  VALUES (username, password, firstname, lastname, role, banstatus, verifystatus);

  COMMIT;

END;

and when I try to call it in OracleSQL:

call INSERTUSER(Dean, pass1, Bob, Smith, Admin, 0, 1)

I get the error message:

Error starting at line 1 in command:
call INSERTUSER(Dean, pass1, Bob, Smith, Admin, 0, 1)
Error report:
SQL Error: ORA-06576: not a valid function or procedure name
06576. 00000 -  "not a valid function or procedure name"
*Cause:    Could not find a function (if an INTO clause was present) or
           a procedure (if the statement did not have an INTO clause) to
           call.
*Action:   Change the statement to invoke a function or procedure

Can you guys spot any obvious mistakes/problems? I'm not really sure I'm getting this error message..

Upvotes: 0

Views: 2004

Answers (2)

DeaIss
DeaIss

Reputation: 2585

Found the issue! Had to use single quotes instead of double quotes when calling the function!

Upvotes: 0

Alen Oblak
Alen Oblak

Reputation: 3325

You can call your procedure like this:

begin
   INSERTUSER('Dean', 'pass1', 'Bob', 'Smith', 'Admin', 0, 1);
end;

Upvotes: 1

Related Questions