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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Triggers Newbie

Re: Triggers Newbie

From: Michael Bialik <michael_bialik_at_my-deja.com>
Date: Sun, 01 Oct 2000 05:48:51 GMT
Message-ID: <8r6j83$38q$1@nnrp1.deja.com>

Hi.

 You correct in your assumption that the row is not inserted bacause  of ROLLBACK.
 The solution exists only in Oracle 8i (if you are using that version).  In that case you have to "wrap" INSERT statement inside stored  procedure and define the procedure itself using   PRAGMA AUTONOMOUS_TRANSACTION  HTH. Michael.

In article <xawB5.14216$O7.192119_at_ozemail.com.au>,   "Susan Entwisle" <sentwisle_at_ozemail.com.au> wrote:
> Hi,
>
> I am writing my first trigger and I have a problem with the exception
 clause
> (see below) , what I would like to do in the event of an exception
 write to
> a log table and inform the user. When this exception handler is
 executed
> the RAISE_APPLICATION_ERROR message is being displayed but there is no
> record being inserted into the log_info table. I believe this is
 occurring
> because the RAISE_APPLICATION_ERROR is causing the rollback to occur
 to the
> log_info table. As I cannot directly use the COMMIT statement (nor
 would I
> want to commit) in a trigger is there any other way that I can
 perform both
> of these tasks.
>
> Thanking you in advance.
>
> Cheers
> Susan
>
> EXCEPTION
>
> WHEN e_TimesEqual THEN
> /* Handler for when the commence times and end time are equal */
> INSERT INTO log_info (time_logged, machine_logged, code_id, info)
> VALUES (v_CurrentTimeDate, v_Terminal, -20000, 'Invalid Commence
 Time and
> End Time Equal for Packer' || :new.packer_id || 'from ' ||
> :new.commence_time || ' to ' || :new.end_time );
> RAISE_APPLICATION_ERROR(-20000, 'Invalid Commence Time and End Time
> Equal');
>
>

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Sun Oct 01 2000 - 00:48:51 CDT

Original text of this message

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