简体   繁体   English

PLS-00201触发器发生错误

[英]PLS-00201 Error Occured for the Trigger

I wrote a Trigger for the Auto increment Please find the sequence and the trigger below. 我为自动增量编写了一个触发器,请在下面找到序列和触发器。

CREATE SEQUENCE WEB_FE_IPO_IPO_APPLICATION_SEQ;
CREATE OR REPLACE TRIGGER WEB_FE_IPO_IPO_APPLICATION_TRG
  BEFORE INSERT
    ON WEB_FE_IPO_IPO_APPLICATION
      REFERENCING NEW AS NEW_ROW
      FOR EACH ROW
BEGIN
SELECT WEB_FE_IPO_IPO_APPLICATION_SEQ.NEXTVAL INTO NEW_ROW.APPLICATION_ID FROM dual;
END;
/ 

My Problem is when i executing this trigger it gives me an error like below. 我的问题是,当我执行此触发器时,它给了我如下错误。

Error(2,1): PL/SQL: SQL Statement ignored
Error(2,52): PLS-00201: identifier 'NEW_ROW.APPLICATION_ID' must be declared
Error(2,75): PL/SQL: ORA-00904: : invalid identifier

I cant find the issue. 我找不到问题。 can anyone please help? 谁能帮忙吗?

You need to prefix new_row with a colon. 您需要在new_row加上一个冒号。 into :new_row.application_id . into :new_row.application_id Since you're on 11g, you don't need a select into , you can just do a direct assignment of the nextval . 由于您使用的是11g,因此不需要select into ,您可以直接分配nextval I can't see a reason to bother changing the name of the :new pseudorecord either. 我也看不出有理由更改:new伪记录的名称的原因。 So I'd just do 所以我会做

CREATE OR REPLACE TRIGGER WEB_FE_IPO_IPO_APPLICATION_TRG
  BEFORE INSERT ON WEB_FE_IPO_IPO_APPLICATION
  FOR EACH ROW
BEGIN
  :new.application_id := WEB_FE_IPO_IPO_APPLICATION_SEQ.NEXTVAL;
END;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM