oracle 在 Squirrel 中创建/替换触发器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4333267/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 22:05:18  来源:igfitidea点击:

Create/replace trigger in Squirrel

oraclesquirrel-sql

提问by Guus

I use squirrel 3.2.0 When I try to replace this trigger:

我使用 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;
/

I get the message "Please input the parameter values. Value for ':new'"

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

When I click OK the result message is:

当我单击确定时,结果消息是:

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

In my application I get an error "ORA-04098: trigger 'CRW_INS_TRIG' is invalid and failed re-validation"

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

Does this has to do with Squirrel? If so, how can I solve this?

这和松鼠有关系吗?如果是这样,我该如何解决这个问题?

回答by yatul

You should unload "sqlparam" plugin in SQuirrel, after that it won't ask you to fill values for ":paramName" variables

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

回答by Bob Jarvis - Reinstate Monica

You might want to add a REFERENCING line to your trigger so that it would look like

您可能希望在触发器中添加 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;

Try that. If it doesn't work, try executing the statement using a different tool (e.g. SQL*Plus, PL/SQL Developer, Toad, etc).

试试那个。如果它不起作用,请尝试使用不同的工具(例如 SQL*Plus、PL/SQL Developer、Toad 等)执行语句。

Share and enjoy.

分享和享受。