|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
I need help urgently with this trigger
Following is the table on which I am trying to run the trigger: create table bookings ( Booking_no NUMBER primary key, Cust_no NUMBER, Date_reserved DATE, Reserved_by CHAR(12), Date_rent_start DATE, Rental_period NUMBER, Registration CHAR(7), Model_name CHAR(8), Miles_out NUMBER, Miles_in NUMBER, Amount_due NUMBER, Paid CHAR(1) ); I am trying to create a trigger that would print cust_no when the sysdate-date_rent<=3 here's the trigger: create or replace trigger ALREADY_BOOKED before insert on bookings FOR EACH ROW DECLARE BOOKED_NO NUMBER; CUSTOMER_NO NUMBER; BEGIN CUSTOMER_NO := :new.cust_no; select COUNT(*) INTO BOOKED_NO from bookings where (sysdate-Date_rent_start) <=3 AND bookings.Cust_no = :new.Cust_no; IF BOOKED_NO >0 THEN DBMS_OUTPUT.PUT_LINE(:new.cust_no); END IF; END; / The trigger doesn't work. Thanks in advance. |
![]() |
| Viewing: Dev Shed Forums > Databases > Database Management > Help with triggers |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|