【发布时间】:2020-01-15 19:22:45
【问题描述】:
我的代码目标是造成幻影行。我理解这个过程,但我正在努力让我的第一个 sql 脚本运行
CREATE OR REPLACE PROCEDURE PHANTOM
IS
DECLARE
ENAME CHAR;
ENAME EMPLOYEE%ROWTYPE;
BEGIN
SELECT * INTO ENAME
FROM EMPLOYEE
WHERE NAME = 'Albert';
DBMS_OUTPUT.PUT_LINE(ENAME.NAME);
DBMS_LOCK.SLEEP(15);
DBMS_OUTPUT.PUT_LINE(ENAME.NAME);
END;
/
这是我的第一个脚本,其中声明了一个 char 类型的变量 ENAME,并从名称等于 Albert 的表 EMPLOYEE 中获取 NAME 的值。然后在 DMBS 语句中调用该变量以返回名称。我的第二个脚本仅包含更新和提交以完成幻像过程。
当我尝试编译这个程序时,我得到了两个错误
错误 1
Error(5,1): PLS-00103: Encountered the symbol "DECLARE" when expecting one of the following: begin function pragma procedure subtype type <an identifier> <a double-quoted delimited-identifier> current cursor delete exists prior external language The symbol "begin" was substituted for "DECLARE" to continue.
错误 2
Error(21,5): PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: ( begin case declare end exception exit for goto if loop mod null pragma raise return select update while with <an identifier> <a double-quoted delimited-identifier> <a bind variable> << continue close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge pipe purge json_exists json_value json_query json_object json_array
我该如何解决这个问题?谢谢你
【问题讨论】: