Results 1 to 2 of 2

Thread: trigger...

  1. #1
    Join Date
    Nov 2002
    Posts
    22

    Unanswered: trigger...

    hi guys how can i write a trigger on myemp tabl to;

    1. Sales persons should always receive commission. Employees who are not sales persons should never receive a commission;

    2. Salaries may only be increased, never decreased.

  2. #2
    Join Date
    Jul 2003
    Posts
    2,296

    Re: trigger...

    Look up documentation for triggers regarding ON INSERT and ON UPDATE

    So (assuming you have already updated all your data to reflect your rules and are only moving forward):

    #1 trigger will be ON/AFTER INSERT into EMP, set COMMISSION = 'Y' where Emp_type = 'Salesperson' ELSE COMMISION = 'N'

    #2 trigger will be ON/BEFORE UPDATE only update if new:salary > old:salary

    haven't made a trigger in a while so please look up the proper syntax etc.


    Originally posted by mark00189
    hi guys how can i write a trigger on myemp tabl to;

    1. Sales persons should always receive commission. Employees who are not sales persons should never receive a commission;

    2. Salaries may only be increased, never decreased.
    - The_Duck
    you can lead someone to something but they will never learn anything ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •