Is updating a certain column : Updating « Trigger « Oracle PL/SQL Tutorial






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>
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>
SQL>








28.17.Updating
28.17.1.Is updating a certain column
28.17.2.If updating and new value equals old value