Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Trigger Help Need Please

Re: Trigger Help Need Please

From: Martin Haltmayer <Martin.Haltmayer_at_0800-einwahl.de>
Date: 2000/05/12
Message-ID: <391C1C33.A386C05F@0800-einwahl.de>#1/1

If you want to protect against duplicates use a unique constraint. Most likely It serves your purpose without hassling with triggers.

Martin

SB wrote:
>
> 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
> END-IF;
> END;
> /
>
> 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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US