我收到錯誤,如:錯誤:00103的PLSQL過程
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.
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.
,我的代碼是:
CREATE OR REPLACE PROCEDURE procExplicitCursorAccountSlct
AS
DECLARE
CURSOR C1 IS SELECT * FROM ACCOUNT;
BEGIN
OPEN C1;
FOR i in C1 LOOP
FETCH C1 INTO ID,ACCOUNTTYPE,BALANCE;
EXIT WHEN C1%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(ID||'-'||ACCOUNTTYPE||'-'||BALANCE);
DBMS_OUTPUT.PUT_LINE(C1%ROWCOUNT);
END LOOP;
CLOSE C1;
END;
只是刪除'DECLARE'關鍵字。請參閱CREATE PROCEDURE的語法:https://docs.oracle.com/database/121/LNPLS/create_procedure.htm#LNPLS01373 Threre在IS/AS關鍵字後面直接顯示* declre_section *,但本節不包含DECLARE關鍵字**。此關鍵字僅用於匿名塊和觸發器中。 – krokodilko