在 Squirrel 中创建/替换触发器

发布于 2024-10-05 04:58:32 字数 697 浏览 3 评论 0原文

我用的是松鼠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:触发器“CRW_INS_TRIG”无效且重新验证失败”

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

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

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'"

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"

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

可可 2024-10-12 04:58:32

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

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

回眸一遍 2024-10-12 04:58:32

您可能想在触发器中添加一个 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。如果它不起作用,请尝试使用不同的工具(例如 SQL*Plus、PL/SQL Developer、Toad 等)执行该语句。

分享并享受。

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

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).

Share and enjoy.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文