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: Beginner: trigger doesn't rollback insert

Re: Beginner: trigger doesn't rollback insert

From: DA Morgan <damorgan_at_x.washington.edu>
Date: Sat, 07 May 2005 13:06:45 -0700
Message-ID: <1115496159.822095@yasure>


Assaf wrote:

> My BEFORE INSERT trigger checks for invalid quantities.
>
>
>
> If QTY <= 0, a raise_application_error is issued and outputs a message to
> the user. I was also expecting the error to roll back the insert but the
> record is still inserted into the table.
>
>
>
> Manual inserts via SQL*Plus seem to be OK (i.e., rolled back by trigger).
> But the trigger does commit records inserted through stored procs.
>
>
>
> How can I prevent the trigger from performing the insert? Any pointers?
>
>
>
> Thanks!
>
>
>
> - Assaf

Oracle is not SQL Server. Look up 'atomic transactions' with respect to Oracle. A trigger can not contain either COMMIT or ROLLBACK. These actions must be taken explicitly, as in SQL*Plus, or in code within a procedure or package.

-- 
Daniel A. Morgan
University of Washington
damorgan_at_x.washington.edu
(replace 'x' with 'u' to respond)
Received on Sat May 07 2005 - 15:06:45 CDT

Original text of this message

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