TSQL81 Iplement a trigger that restricts the seating date to

T-SQL-8-1

Iplement a trigger that restricts the seating date to be a date on or after the current date.

DATABASE (key fields are underlined)

EMPLOYEE TABLE: EMP_ID, EMP_LNAME, EMP_STREET, EMP_CITY, EMP_STATE, EMP_ZIP, EMP_START_DATE

TABLES TABLE: TABLE_ID, AREA_ID, TABLE_SEATS

AREA TABLE: AREA_ID, AREA_NAME, AREA_SUPERVISOR_EMPLOYEE_ID

CUSTOMER TABLE: CUST_ID, CUST_LAST_NAME, CUST_NUMBER_OF_GUESTS

ASSIGNMENT TABLE: EMP_ID, TABLE_ID

SEATING TABLE: CUST_ID, TABLE_ID, SEATING_COST, SEATING_DATE, SEATING_TIP

Solution

CREATE OR REPLACE TRIGGER seating_trig BEFORE INSERT ON seatingtable FOR EACH row DECLARE seating_date DATE; BEGIN SELECT o.seating_date INTO seating FROM seatingtable o IF seating_date < sysdate THEN raise_application_error(-20002, (\'Seating Date should be on or after Todays Date\')); END IF; END;
T-SQL-8-1 Iplement a trigger that restricts the seating date to be a date on or after the current date. DATABASE (key fields are underlined) EMPLOYEE TABLE: EMP

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site