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: declare variable in trigger

Re: declare variable in trigger

From: Vince <vinnyop_at_yahoo.com>
Date: 27 Dec 2006 08:28:49 -0800
Message-ID: <1167236929.569884.12870@73g2000cwn.googlegroups.com>

harun.bolat_at_netsim.net wrote:
> thanks,
>
> we already tested block label, but not worked.
>
> I think there is no solution. we have to change variable name.
>
> thanks a lot.
>
>
> hasta_l3_at_hotmail.com yazdı:
> > harun.bolat_at_netsim.net a écrit :
> > > we use firebird database and try to migrate project to oracle. All our
> > > database object( trigger, stored procedure) we use variable name same
> > > as database field name and we have no problem. using variable same as
> > > field name, makes code more readable.
> > > to migrate oracle from firebird we try to write convert program that
> > > takes firebird sql and produce oracle sql code.
> > >
> > > In oracle stored procedure we can use variable name same as field name
> > > like procedure_name.variable_name syntax. This syntax why not exists it
> > > trigger?
> >
> > Perhaps block labels will help you - something
> > like this little crazie :
> >
> > CREATE OR REPLACE TRIGGER KULLANIC_BI BEFORE INSERT ON KULLANIC
> > FOR EACH ROW
> > BEGIN
> > <<KULLANIC_BI>>
> > DECLARE
> > NSUID INTEGER;
> > BEGIN
> > NSUID := 5;
> > SELECT MAX(K.NSUID) AS F_1
> > INTO NSUID
> > FROM KULLANIC K
> > WHERE K.NSUID = KULLANIC_BI.NSUID;
> > END;
> > END;
> >
> > Best regards
> >
> > --- Raoul

It may be helpful if you post the entire trigger. Simply selecting a max value and doing nothing with it doesn't seem likely. Are you trying to find the next available NSUID value? You may want to look into using sequences and avoid performing a lookup for every row inserted. Received on Wed Dec 27 2006 - 10:28:49 CST

Original text of this message

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