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

Home -> Community -> Usenet -> c.d.o.misc -> Re: database triggers

Re: database triggers

From: Galen Boyer <galenboyer_at_hotpop.com>
Date: 23 Dec 2002 09:40:13 -0600
Message-ID: <u65tkd9vp.fsf@standardandpoors.com>


On Mon, 23 Dec 2002, mousa.al-mohammed_at_nokia.com wrote:

[...]

> I have tried to use a trigger like:
> -------------
> CREATE OR REPLACE TRIGGER DELETE_OLD_MSGS
> BEFORE INSERT OR UPDATE OR DELETE ON MESSAGES
> REFERENCING OLD AS oldRow
> FOR EACH ROW
> BEGIN
>
> DELETE FROM MESSAGES WHERE :oldRow.msg_valid_date < SYSDATE;

[...]

> I need this trigger in order not to show the user any old
> messages.

Why not create a view on top of messages which selects everything where msg_valid_date >= SYSDATE? Then, create a job (as Daniel suggested) to delete the rows, if you really need to delete them?

Seems alot more bulletproof than trying to figure out what code needs to execute during different operations on a particular table.

-- 
Galen Boyer
Received on Mon Dec 23 2002 - 09:40:13 CST

Original text of this message

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