Home » SQL & PL/SQL » SQL & PL/SQL » Re: Need to implement this business rule for triggers
Re: Need to implement this business rule for triggers [message #38812] Thu, 16 May 2002 08:50
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
Sid, it seems to me that your trigger could be simplified to:

create or replace trigger salesman_com_only
  before insert or update on empy
  for each row
begin
  if :new.job = 'SALESMAN' then
    if inserting or (updating and :old.job <> 'SALESMAN') then
      :new.comm := 0;
    end if;
  else    
    if :new.comm is not null then
      raise_application_error(-20501, 'Only salesman can have a commission');
    end if;  
  end if;
end;
/
Previous Topic: Re: wild card filtering
Next Topic: sql query
Goto Forum:
  


Current Time: Fri Apr 26 10:08:09 CDT 2024