Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Trigger Help Need Please
Im writing a row trigger at the moment which will fire before an insert on a table. It will check that no double bookings will occur. My aim is to read all the rows into a temporary table then use a cursor on that temporary table to scan through the rows and check that the to and from dates on the record to be inserted do not overlap with any dates currently in the table. Then I need to delete all the records in the temporary table. I thought about writting three triggers i.e. one to insert, one to scan with the cursor, one to delete. But I now find that this is impossible as there is no way to order triggers and this method relies on pre-ordering. So I need to combine the triggers but how can this be achieved within the scope of the trigger? I need to scan with the cursor after the insert and then loop for each row and delete then :
CREATE OR REPLACE TRIGGER sercure_booking
BEFORE INSERT OR UPDATE ON booking
FOR EACH ROW
BEGIN
IF INSERT THEN
INSERT INTO TEMP_TABLE( table variable names go here) VALUES( table variable names go here) ELSEIF UPDATE same as insert
Where would I place the code for my cursor and deletion activities?
This is all strange to me. I am just a humble COBOL programmer.
I can also be emailed at paul.hargreaves1_at_net.ntl.com
Many Thanks
Paul
Received on Fri May 12 2000 - 00:00:00 CDT