各位大大好
小弟在寫SQL的trigger一直不順,
想請教有經驗的大大應該如何解,萬分感激。
create or replace trigger GETRES_ID
BEFORE insert or update of RES_ID on AS_RES_SAVE
DECLARE
SERVICEID := 10439;
v_a RES_ID%type;
BEGIN
IF (RES_ID is null) THEN
SERVICEID := SERVICEID+1;
select seq_as_res.nextval into v_b from dual;
END IF;
END;
/
小弟想要當RES_ID為null時觸發,每筆資料中的RES_ID以seq_as_res.nextval代替,
並將SERVICEID加1
上面這段code在oracle執行時都會有Warning: Trigger created with compilation errors.訊息。
且在error中的訊息是
2/14 PLS-00103: Encountered the symbol "=" when expecting one of the
following:
constant exception <an identifier>
<a double-quoted delimited-identifier> table LONG_ double ref
char time timestamp interval date binary national character
nchar
The symbol "<an identifier>" was substituted for "=" to continue.