Re: Stored procedure problem
Posted in 1999
Topics: High Availability & Replication, Stored Procedures & SPL
I'm just not sure how accurate is this sysmaster
query in a multiuser environment.
Does it return MY last generated serial value ?
Best Regards,
Octav
Vardan.Aroustamian@chase.com wrote:
>
> Octav Chiriac <com@netinfo-moldova.com> wrote:
>
> >
> >
> > You can use the dbinfo('sqlca.sqlerrd1') function to retrieve
> > the last generated serial value after an INSERT.
> >
> > Hope this help,
> > Octav
> >
> > On Wed, Feb 10, 1999 at 03:07:19PM +0800, Organo, Norman wrote:
> > > Hi Informix-list,
> > >
> > > How do you get the newest/highest value of a serial column inside a
> stored
> > > procedure?
> > > I remember that a certain system catalog table is used to store this.
> Can
> > > anyone tell me
> > > what table that is?
>
> I prefer to use method mentioned above, but anyway there is a place:
>
> select tabname, serialv
> from systables t, sysmaster:sysptnhdr p
> where tabname = 'your_table' and
> t.partnum = p.partnum;>
> > >
> > > Norman
> >
> > --
> > Octav Chiriac Phone: (373) 2 21 20 96
> > NetInfo S.R.L. Fax: (373) 2 21 36 59
> > Chisinau (373) 2 24 00 83
> > Moldova, Republic of mailto:com@netinfo-moldova.com
> >
>
> HTH also
>
> Vardan Aroustamian
>
> --
> vaar@geocities.com
Octav Chiriac wrote:
> I'm just not sure how accurate is this sysmaster
> query in a multiuser environment.
> Does it return MY last generated serial value ?
No. The sysmaster query returns the current next serial number NOT the
number you just inserted. To get that value you must use the dbinfo()
method which returns the value of the sqlerrd1 field in the sql control
area structure (sqlca) which contains the last serial number inserted
as part of the last statement. The dbinfo() call should immediately
follow the insert statement and the value saved if needed later in the
code.
Art S. Kagel
> Best Regards,
> Octav
> Vardan.Aroustamian@chase.com wrote:
> > Octav Chiriac <com@netinfo-moldova.com> wrote:
> > > You can use the dbinfo('sqlca.sqlerrd1') function to retrieve
> > > the last generated serial value after an INSERT.
> > > Hope this help,
> > > Octav
> > > On Wed, Feb 10, 1999 at 03:07:19PM +0800, Organo, Norman wrote:
> > > > Hi Informix-list,
> > > > How do you get the newest/highest value of a serial column inside a
> > stored
> > > > procedure?
> > > > I remember that a certain system catalog table is used to store this.
> > Can
> > > > anyone tell me what table that is?
> > I prefer to use method mentioned above, but anyway there is a place:
> >
> > select tabname, serialv
> > from systables t, sysmaster:sysptnhdr p
> > where tabname = 'your_table' and
> > t.partnum = p.partnum;