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: Oracle Triggers variable

Re: Oracle Triggers variable

From: sybrandb <sybrandb_at_gmail.com>
Date: 8 May 2007 01:55:20 -0700
Message-ID: <1178614520.446163.107030@e65g2000hsc.googlegroups.com>


On May 8, 10:41 am, Kovu <kovut..._at_gmail.com> wrote:
> On 8 mayo, 09:26, sybrandb <sybra..._at_gmail.com> wrote:
>
>
>
>
>
> > On May 8, 9:53 am, Kovu <kovut..._at_gmail.com> wrote:
>
> > > Hello, I'm writing this post to ask you about If can I get a variable
> > > of trigger to my code in asp.net 2.0?.
>
> > > I have this code in my trigger:
>
> > > create or replace TRIGGER CORRELATIVO_EXPEDIENTE BEFORE INSERT ON
> > > EXP REFERENCING NEW AS New FOR EACH ROW DECLARE contador NUMBER;
> > > BEGIN contador:=0; SELECT NVL(MAX(id_exp),0) +1 INTO contador FROM
> > > EXP; :NEW.id_exp:=contador; END;
>
> > > I want to get "contador".
>
> > > Thanks for all.
>
> > You would set up a package with a variable.
> > In the package is 1 procedure to set the variable (which is to be
> > called by the trigger)
> > and one function to retrieve the variable.
> > You do realize your current approach (select max(id) from <table on
> > which is the trigger>) won't work, and what's more is unscalable? The
> > full table scan on exp is going to take more an more time. Why don't
> > you use a sequence?
>
> > --
> > Sybrand Bakker
> > Senior Oracle DBA
>
> Can I use a sequence on version 9i?
>
> Thanks.- Hide quoted text -
>
> - Show quoted text -

sequences have been available since Oracle 6

--
Sybrand Bakker
Senior Oracle DBA
Received on Tue May 08 2007 - 03:55:20 CDT

Original text of this message

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