Re: sqlca and spl
Posted in 1998
Within SPL you can just do:
LET nrow = DBINFO("sqlca.sqlerrd2");
or
LET lastser = DBINFO("sqlca.sqlerrd1");
There's no need to do that SELECT.
Katrin Goericke wrote in message <36544CDE.2172@taz.de>...
>> I especially need to know last serial id of an inserted row (any faq?)
>> Until now I'm using max() but it could cause concurrency troubles.
>
>The estimated count of rows you get in this way:
>
>create procedure getnumrow()
> returning int;>
> define nrow int;
> select unique dbinfo("sqlca.sqlerrd2") into nrow
> from "informix".systables;> return nrow;
>end procedure;
>
>... the next serial
>
>CREATE PROCEDURE getnextid()
>returning int;>
> define mid int;
> select unique dbinfo("sqlca.sqlerrd1") into mid
> from "informix".systables;> return mid;
>
>END PROCEDURE;
>
>--
>Gru' Katrin
>__________
>
> _/_/_/_/_/ _/_/_/_/ _/_/_/_/ Katrin Goericke katrin@taz.de
> _/ _/ _/ _/ die tageszeitung
> _/ _/_/_/_/ _/ Germany
> _/ _/ _/ _/ D-10969 Berlin Phone:
>+49-30-2516092
> _/ _/ _/ _/_/_/_/ Kochstr. 18 FAX :
>+49-30-2510694