我正在运行 Oracle SQL 开发人员,并且我有以下存储过程。我对此很陌生,但真的不确定为什么这不起作用:
CREATE OR REPLACE PROCEDURE CHECKDUPLICATE(
username1 IN USERS.USERNAME%TYPE,
o_username OUT USERS.USERNAME%TYPE
)
IS
BEGIN
SELECT USERNAME
INTO o_username
FROM USERS WHERE username1 = o_username;
END;
当我尝试调用它时:
DECLARE
o_username USERS.USERNAME%TYPE;
BEGIN
CHECKDUPLICATE('Jacklin', o_username);
DBMS_OUTPUT.PUT_LINE('username : ' || o_username);
END;
我收到错误消息:
Error starting at line 1 in command:
DECLARE
o_username USERS.USERNAME%TYPE;
BEGIN
CHECKDUPLICATE(Jacklin, o_username);
DBMS_OUTPUT.PUT_LINE('username : ' || o_username);
END;
Error report:
ORA-06550: line 5, column 19:
PLS-00201: identifier 'JACKLIN' must be declared
ORA-06550: line 5, column 4:
PL/SQL: Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
“必须声明标识符'Jacklin'是什么意思?(表称为USERS,列名称为USERNAME)。任何帮助将不胜感激。
编辑**我把杰克林放在引号里,我现在收到这条消息:
Error report:
ORA-01403: no data found
ORA-06512: at "L13JAV04.CHECKDUPLICATE", line 9
ORA-06512: at line 6
01403. 00000 - "no data found"
*Cause:
*Action:
尽管 Jacklin 确实存在于数据库中!