title: how to create a trigger in oracle which will restrict insertion and update queries on a table based on a condition
body: <p>I have account table as this--</p>
  
  <pre><code>create table account
  (
  acct_id int,
  cust_id int,
  cust_name varchar(20)  
  )
  
  insert into account values(1,20,'Mark');
  insert into account values(2,23,'Tom');
  insert into account values(3,24,'Jim');
  </code></pre>
  
  <p>I want to create a trigger which will ensure that no records can be inserted or update in account table having acct_id as 2 and cust_id as 23.</p>
  
  <p>My code is --</p>
  
  <pre><code>create trigger tri_account
  before insert or update
  on account
  for each row
  begin
      IF (:new.acct_id == 2 and :new.cust_id == 23) THEN 
          DBMS_OUTPUT.PUT_LINE('No insertion with id 2 and 23.');
  rollback;
      END IF; 
  end;
  </code></pre>
  
  <p>so this trigger is created , but with compilation error.
  now when I insert any record with acct_id as 2 and cust_id as 23,it doesent allow.
  But I get an error saying 
  <strong>ORA-04098: trigger 'OPS$0924769.TRI_ACCOUNT' is invalid and failed re-validation</strong> </p>
  
  <p>I don't understand this.I also want to show a message that dis insertion is not possible.
  please Help... </p>