Skip to Main Content

SQL & PL/SQL

A trigger to give a 10 per cent discount to a regular customer

3128080Dec 17 2015 — edited Dec 17 2015

Hi,

I am trying to create a trigger to give a discount of 10% of the field 'totalCost' in the bookings table, if the 'statusname' is regular in the Passengers table. Below is what I have come up with so far. But I know its wrong. Can you please help?

create or replace TRIGGER Ten_Percent_Discount

BEFORE UPDATE ON Bookings

FOR EACH ROW

BEGIN

UPDATE Bookings b

SET b.TotalCost = 0.10 * TotalCost

WHERE Passengers.StatusName = 'Regular';

END;

Thanks,

Fareedh

This post has been answered by PamNL on Dec 17 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 14 2016
Added on Dec 17 2015
23 comments
4,017 views