Re: Serials and Stored procedures
Posted in 2000
From: Thomas Parsli <thomas.parsli@startsiden.no> > >rwilson@ntsource.com (Rob Wilson) writes: > > > Thomas Parsli (thomas.parsli@startsiden.no) wrote: > > : "Paul Harman" <paul@kasterborus.demon.co.uk> writes: > > > > : > there are ways around it in all the other > > : > programming languages I've used - or is that just because they've >done this > > : > call "behind my back"? Besides, what if someone else gets in there >first > > : > with an insert before I do my select? > > > > : You're interested in _your_ sessions serial from _your_ sessions > > : insert -right? > > > > : Thomas > > > > When you use DBINFO, you will get the last serial value from _your_ > > session. Even if other people have made inserts after this session's, > > you will have the correct number. > >From the manual (Guide to SQL, Dec. 1999): > >The 'sqlca.sqlerrd1' option returns a single integer that provides the last >serial value that is inserted into a table. To ensure valid results, use >this >option immediately following a singleton INSERT statement that inserts a >single >row with a serial value into a table. > >Why the _ensure_ and _immediately_ if it's session dependant? Because any other SQL statement might affect the values contained in sqlca. ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com