Mega Code Archive

 
Categories / Oracle PLSQL Tutorial / Trigger
 

Is updating a certain column

SQL> SQL> CREATE TABLE account_transaction   2  (transaction_id     NUMBER NOT NULL PRIMARY KEY,   3   account_id         NUMBER NOT NULL,   4   transaction_type   VARCHAR2(3) NOT NULL,   5   transaction_amount NUMBER NOT NULL,   6   comments           VARCHAR2(30)); Table created. SQL> SQL> CREATE OR REPLACE TRIGGER validate_update   2  BEFORE UPDATE ON account_transaction   3  FOR EACH ROW   4  BEGIN   5    IF UPDATING('ACCOUNT_ID') THEN   6      DBMS_OUTPUT.put_line ('ERROR');   7    END IF;   8  END;   9  / Trigger created. SQL> show error No errors. SQL> SQL> drop table account_transaction; Table dropped. SQL>