我试图运行以下PL/SQL
脚本:
DECLARE
CURSOR cr IS SELECT NOMLOG, NOMPOSTE, DATEACH, DATEINS from LOGICIEL L, INSTALLATION I, POSTE P where I.NLOG = L.NLOG AND P.NPOSTE = I.NPOSTE;
inst INSTALLATION%ROWTYPE;
BEGIN
OPEN cr;
FETCH cr INTO inst;
WHILE cr%FOUND LOOP
IF inst.DATEACH IS NULL AND inst.DATEINS IS NOT NULL THEN
dbms_output.put_line('Date d''achat inconnue pour le logiciel' || inst.NOMLOG || ' sur ' || inst.NOMPOSTE);
ELSEIF inst.DATEACH IS NOT NULL AND inst.DATEINS IS NULL THEN
dbms_output.put_line('Pas de date d''installation pour le logiciel' || inst.NOMLOG || ' sur ' || inst.NOMPOSTE);
ELSEIF inst.DATEACH IS NULL AND inst.DATEINS IS NULL THEN
dbms_output.put_line('Date d''installation et date d''achat sont inconnue pour le logiciel' || inst.NOMLOG || ' sur ' || inst.NOMPOSTE);
ELSE
IF inst.DATEACH < inst.DATEINS
dbms_output.put_line('Logiciel' || inst.NOMLOG || ' sur ' || inst.NOMPOSTE || ', attente ' || inst.DATEACH - inst.DATEINS || ' jour(s)');
ELSE
dbms_output.put_line('Logiciel' || inst.NOMLOG || ' installé sur ' || inst.NOMPOSTE || ', ' || inst.DATEACH - inst.DATEINS || ' jour(s) avant d''être acheté!');
END IF
END IF;
FETCH cr INTO inst;
END LOOP;
CLOSE cr;
END;
/
但我收到此错误消息:
ERROR at line 10:
ORA-06550: line 10, column 11:
PLS-00103: Encountered the symbol "INST" when expecting one of the following:
:= . ( @ % ;
The symbol ":=" was substituted for "INST" to continue.
ORA-06550: line 10, column 36:
PLS-00103: Encountered the symbol "" when expecting one of the following:
; and or
The symbol "and" was substituted for "" to continue.
ORA-06550: line 10, column 64:
PLS-00103: Encountered the symbol "THEN" when expecting one of the following:
; and or
ORA-06550: line 12, column 11:
PLS-00103: Encountered the symbol "INST" when expecting one of the following:
:= . ( @ % ;
The symbol ":=" was substituted for "INST" to continue.
ORA-06550: line 12, column 57:
PLS-00103: Encountered the symbol "THEN" when expecting one of the following:
; and or
ORA-06550: line 16, column 6:
PLS-00103: Encountered the symbol "DBMS_OUTPUT" when expecting one of the
following:
. ( * @ % & - + / at mod remainder rem then
<an exponent (**)> and or || multiset
The symbol "." was substituted for "DBMS
我该如何解决这个问题?
答案 0 :(得分:0)
尝试将第8行更改为...
IF inst.DATEACH = '' AND inst.DATEINS <> '' THEN
同时将所有其他布尔表达式更改为仅使用等号而不是:=
你有没有考虑说过......
IF inst.DATEACH is not null AND inst.DATEINS <> '' THEN
答案 1 :(得分:0)
在条件语句中不使用:=运算符。只尝试等号=
IF inst.DATEACH = '' AND inst.DATEINS <> '' THEN
dbms_output.put_line('Date d''achat inconnue pour le logiciel' || inst.NOMLOG || ' sur ' || inst.NOMPOSTE);
ELSEIF inst.DATEACH <> '' AND inst.DATEINS = '' THEN
......等等