简体   繁体   中英

(oracle 12c) pls-00201 error when make trigger with new.column

I want to make trigger this is raising error when emp.sal < 10 .

CREATE OR REPLACE TRIGGER sal_more_than_ten_trigger
  BEFORE INSERT OR UPDATE ON emp FOR EACH ROW
  DECLARE
  sal_lease_than_ten_error EXCEPTION;
  BEGIN
    IF new.sal < 10 THEN -- error occured!!!!!!!!!!!!!!!!!!!!!!!!!
      RAISE sal_lease_than_ten_error;
    END IF;
  EXCEPTION
  WHEN sal_lease_than_ten_error THEN
  RAISE_APPLICATION_ERROR(-20001, 'give me more');
END;
/

How do I compare new emp.sal with 10 ?

您忘记了new前面的冒号:

IF :new.sal < 10 THEN

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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