Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Problem with trigger/sqlca.sqlerrd[2]
Hello,
What do you mean with 'your trigger code is for all the column' - I just set the column 'serial_col' to nextval?
What do you mean with 'your trigger is SERIAL_CO' ?
'sqlca.sqlerrd[2]' is one of the fileds in the 'sqlca' struct.
Sowhere on the web i found following:
"When using Oracle, the SERIAL data type can be emulated with INSERT TRIGGERs. In 4GL programs, the SQLCA structure is filled as expected (after an insert, sqlca.sqlerrd[2] holds the last generated serial value)".
Does anybody know if this is true/working (and how) ?
I tested without success.
Thanks,
Matthias
Herod schrieb:
> You said for "one column" your trigger code is for all the columns.
>
> You said you need to read the value for the SERIAL column.
> but your trigger is SERIAL_CO
>
> I will assume those are the same.
>
> You can use <sequence_name>.currval as long as you are in the same
> transaction.
> But that will only bring back the value for the LAST record you
> inserted, so if you are doing hundreds of records, your out of luck
> that way.
>
> You can set the sequence in the C program, then insert it into the
> table, not needing the trigger at all. But that isn't the greatest
> idea in the world.
>
> You mention sqlca.sqlerrd[2] I have no idea what that is.
>
Received on Mon Mar 13 2006 - 05:59:06 CST