Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Create Trigger with delete
On Wed, 19 Jan 2000 08:47:01 GMT, battail_at_my-deja.com wrote:
>Hello,
>
>My problem is:
>Before inserting new rows in a table TEST
>(for example), I want to delete all the rows
>inserted before in this table, but only the rows
>which have the same value in the column DATE_CALE.
>I need to use a Trigger to do this.
>
>The SQL Code seems like:
>CREATE TRIGGER DELETE_TEST
>BEFORE INSERT ON TEST
>BEGIN
>DELETE FROM TEST WHERE DATE_CALE=:new.DATE_CALE;
>END;
>
>But it doesn't work...
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.
Is there any reason, why you can't just UPDATE those rows?
Apart from the fact you can't change an already changing table, you
should be aware in previous versions of Oracle a delete followed by an
insert of the same row resulted in a hell of a lot space management
problems. If you really can't do an UPDATE, is it possible for you to
issue the DELETE yourself before the INSERT.
In short: what are you up to?
Hth,
Sybrand Bakker, Oracle DBA Received on Wed Jan 19 2000 - 04:44:10 CST
![]() |
![]() |