在Squirrel中创建/替换触发器

时间:2010-12-02 09:05:01

标签: oracle squirrel-sql

我使用squirrel 3.2.0 当我尝试替换此触发器时:

CREATE OR REPLACE TRIGGER crw_ins_trig
  BEFORE INSERT OR UPDATE ON crew
  FOR EACH ROW
DECLARE

BEGIN
    if (:new.crw_id is null) then
        select crw_id_seq.nextval
        into :new.crw_id
        from dual;
    end if;  
END;
/

我收到消息“请输入参数值。值为':new'”

单击“确定”后,结果消息为:

Warning:   Warning: execution completed with warning
SQLState:  null
ErrorCode: 17110
Position: 27

Query 1 of 1, Rows read: 0, Elapsed time (seconds) - Total: 0.023, SQL query: 0.023, Building output: 0

在我的应用程序中,我收到错误"ORA-04098: trigger 'CRW_INS_TRIG' is invalid and failed re-validation"

这与Squirrel有关吗?如果是这样,我该如何解决?

2 个答案:

答案 0 :(得分:15)

您应该在SQuirrel中卸载“sqlparam”插件,之后它不会要求您填写“:paramName”变量的值

答案 1 :(得分:0)

您可能希望在触发器中添加REFERENCING行,使其看起来像

CREATE OR REPLACE TRIGGER crw_ins_trig  
  BEFORE INSERT OR UPDATE ON crew  
  REFERENCING NEW AS NEW
              OLD AS OLD
  FOR EACH ROW  
BEGIN  
    if (:new.crw_id is null) then  
        select crw_id_seq.nextval  
        into :new.crw_id  
        from dual;  
    end if;    
END crw_ins_trig;

试试吧。如果它不起作用,请尝试使用其他工具(例如SQL * Plus,PL / SQL Developer,Toad等)执行该语句。

分享并享受。