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: Raise Error

Re: Raise Error

From: Chintu <agarwalp_at_eeism.com>
Date: Thu, 30 Aug 2007 01:47:03 -0700
Message-ID: <1188463623.958901.323860@o80g2000hse.googlegroups.com>


On Aug 30, 1:41 pm, steph <stepha..._at_yahoo.de> wrote:
> On 30 Aug., 10:23, Chintu <agarw..._at_eeism.com> wrote:
>
>
>
>
>
> > On Aug 30, 1:13 pm, steph <stepha..._at_yahoo.de> wrote:
>
> > > On 30 Aug., 09:48, Chintu <agarw..._at_eeism.com> wrote:
>
> > > > I am trying to raise a simple error in a trigger...But apart from my
> > > > error it also displays two other errors.
> > > > ORA - 6512 at line 10
> > > > and ORA 04088 : error during execution of trigger
>
> > > > My trigger code is
>
> > > > CREATE OR REPLACE TRIGGER CBS_OWNR.BATCHJOBS_TRIG_CHKGROUPNAME
>
> > > > BEFORE INSERT OR UPDATE OF TOGROUP ON
> > > > CBS_OWNR.BILLINGBATCH_BATCHJOBS
> > > > FOR EACH ROW WHEN (NEW.TOgroup IS NOT NULL)
> > > > DECLARE
> > > > NUM_RECS NUMBER;
> > > > FINAL_GROUP VARCHAR2(30);
> > > > E_INVALID_GROUP EXCEPTION;
> > > > BEGIN
> > > > SELECT COUNT(*) INTO NUM_RECS FROM CBS_OWNR.BILLINGBATCH_EMAILGROUPS
> > > > WHERE GROUPNAME=:NEW.TOgroup; --line 10
> > > > IF NUM_RECS = 0 THEN
>
> > > > :NEW.TOgroup:=NULL;
> > > > RAISE_APPLICATION_ERROR(-20901, 'Group Does not Exist');
> > > > END IF;
>
> > > > END;
>
> > > What do you want to achieve? From what I see you seem to want to set
> > > column TOGROUP to null. But as you raise an exception afterwards, this
> > > will never happen. Regarding the other error messages: these are
> > > subsequent errors to error -20901.
>
> > > br,
> > > stephan- Hide quoted text -
>
> > > - Show quoted text -
>
> > Yes if entered value in the ToGroup is not in the Emailgroups Table
> > then set the value to null and and also display a message or error
> > about why it has been changed to null.
>
> > Thanks
> > Chintu
>
> It won't work that way. Maybe you should keep the information about
> the reason for setting it to null in a log-field.- Hide quoted text -
>
> - Show quoted text -

Does that mean that when I use the Raise_application_error...it will not set the ToGroup to null...basically it rollbacks the previous statement..??
otherwise the fact that it is showing three messages ....is that fine ??

chintu Received on Thu Aug 30 2007 - 03:47:03 CDT

Original text of this message

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