Re: How to retrieve a SERIAL value in a STORED PROCEDURE ?
Posted in 1995
} } } Hello, } } Is there a solution to retrieve the SERIAL number after an INSERT } in a STORED PROCEDURE as far as the SQLCA.SQLERRD[2] does not works. } } Is there a better solution than this one : } } set lock mode ... } lock table in share mode } insert into zob ( num ) values ( 0 ) <------ num : serial } select max(num) into var from zob } commit work } This is a reasonable solution but you should force the value inserted into the serial column to be zero throughout your application. The potential problem would come when someone put a large value into the serial column, when this happens the serial column will accept that value as opposed to assigning the next serial value. Mike } } --------------------------------------------------------------- } etienne@cri.univ-lr.fr } (NeXT/MIME-mail are welcome !) } --------------------------------------------------------------- }