Re: SE and SQLCA question
Posted in 1996
Is it not also the case that V7.X does not maintain unique rowids across dbspaces? I dont use this rev yet so I dont know for sure, but I think I've seen a thread here that mentioned it..... To wit, use of the rowid as a unique record identiifer would have to be done cautiously. Would it not be better to manually include a serial as a primary key on each table? Bryan Tonnet In <4snj5j$f66@nic.global-one.no> Nils.Myklebust@ccmail.telemax.no (Nils Myklebust) writes: >This does of course work, but a *warning* is in place here. >You generally do *not* want to insert the rowid of a row into another >table. There are to many things you can do to your database that >invalidates that rowid. You should use primary keys instead. >Sally Woolrich <sally@excelsis.co.uk> wrote: >:Andrea: >:Use the following: >: DECLARE xxx CURSOR FOR >: SELECT ROWID, something FROM sometable >: FOREACH xxx INTO l_rowid, yyy >: .... >:Note that 'l_rowid' MUST be declared as an INTEGER variable. >:In article <4sduha$og0@cssun.mathcs.emory.edu>, Andrea De Angeli >:<deangeli@sienanet.it> writes >:> >:>I am working with 4GL 4.15 and SE 5.06 on a Digital UNIX system (5.3C) >:>and I needed to get the rowid of the rows of a table I was managing. >:>Here it is a little example: >:> >:> declare xxx cursor for >:> select something from sometable >:> foreach xxx into yyy >:> insert into someothertable values (rowid_of_the_selected_row) >:> end foreach >:> lot_of_stuff() >:> update sometable set (somecolumns) = (somevalues) >:> where somecondition <- only one row is updated! >:> insert into someothertable values (rowid_of_the_updated_row) >:> lot_of_snipped_stuff() >:> >:>According to the manuals, I supposed to find this value on >:>the field SQLCA.SQLERRD[6] after any (quoting) SQL statement on >:>the table. >:>I noticed that this was true only for UPDATE statements but not for SELECT >:>(I didn't test INSERT). >:>After a while, I worked around the - possible - bug by explicitatig the >:>rowid request in my SELECTs, but I think this is a little nasty. >:-- >:Sally Woolrich >Nils.Myklebust@ccmail.telemax.no >NM Data AS, P.O.Box 9090 Gronland, N-0133 Oslo, Norway >My opinions are those of my company