为什么这个SQL存储过程不起作用?

时间:2013-07-31 11:36:23

标签: sql oracle stored-procedures call 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;

当我尝试在OracleSQL中调用它时:

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

我收到错误消息:

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
你能发现任何明显的错误/问题吗?我不确定我收到此错误消息..

2 个答案:

答案 0 :(得分:1)

您可以这样调用您的程序:

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

答案 1 :(得分:0)

发现问题!调用函数时,不得不使用单引号而不是双引号!