创建触发器时出错

时间:2013-03-23 10:49:01

标签: oracle triggers

我创建了一个类似下面的触发器。 但它显示了一个错误。

 2/30    PLS-00103: Encountered the symbol "=" when expecting one of the following:
          := ; not null default character

任何人都可以帮我解决这个问题吗? 提前致谢

CREATE OR REPLACE TRIGGER ADRAKLIVE.TRG_HELPDESK
AFTER UPDATE
OF STATUS
ON ADRAKLIVE.TBL_SERVICEREPORT 
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
BEGIN
     declare ts varchar2(10) = :'YES';
 UPDATE tbl_ithelpdesk
       SET it_closed  =: ts
     WHERE call_no = :NEW.call_no;
END;

2 个答案:

答案 0 :(得分:2)

您的触发器格式错误:

CREATE OR REPLACE TRIGGER TRG_HELPDESK
AFTER UPDATE
OF STATUS
ON TBL_SERVICEREPORT 
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
declare
  ts varchar2(10) := 'YES';
BEGIN
 UPDATE tbl_ithelpdesk
       SET it_closed  = ts
     WHERE call_no = :NEW.call_no;
END;
/

答案 1 :(得分:1)

将您的触发器更改为:

CREATE OR REPLACE TRIGGER ADRAKLIVE.TRG_HELPDESK
AFTER UPDATE
OF STATUS
ON ADRAKLIVE.TBL_SERVICEREPORT 
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
DECLARE
   ts varchar2(10);
BEGIN
 ts := 'YES';
 UPDATE tbl_ithelpdesk
       SET it_closed  =: ts
     WHERE call_no = :NEW.call_no;
END;