Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Quick trigger question
A copy of this was sent to mike_andrew_at_usiva.com
(if that email address didn't require changing)
On Thu, 03 Sep 1998 18:51:09 GMT, you wrote:
>Creating a trigger on a table to delete the new row once it has already been
>inserted.
>
>Quick logic would say just delete the row where the row = :new.row
>
>Of course I get the extremely enjoyable mutating table error when I try to
>insert a row. I really don't have much time to devote to working this out,
>but I'm sure this is a quick answer for most of you.
>
>Here is the code for the trigger that returns the MT error when a row is
>inserted.
>
if you are just trying to delete every row inserted after it was inserted then....
create or replace trigger deleteSession
AFTER INSERT on ccsds_www_session
begin
delete from ccsds_www_session;
end;
/
You don't need to do this in a ROW trigger... This will delete only records stored by the current session -- never anyone elses (since they always delete them as well with this trigger and you could not see others rows until they commit but by then its been deleted)...
>CREATE OR REPLACE TRIGGER DeleteSession
>AFTER INSERT ON ccsds_www_session
>FOR EACH ROW
>
>BEGIN
>
>DELETE FROM ccsds_www_session
> WHERE www_session_id = :new.www_session_id
> AND www_user_id = :new.www_user_id;
>
>END;
>/
>
>Thank you in advance for your help !
>Mike
>
>-----== Posted via Deja News, The Leader in Internet Discussion ==-----
>http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA
--
http://govt.us.oracle.com/ -- downloadable utilities
Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Thu Sep 03 1998 - 14:19:34 CDT
![]() |
![]() |