alexs,
if I undestand it correctly, you would like to have the ID before you
insert the record (in order to compose XML attribute).
Use sequence, and in your stored procedure just generate the next value
before you insert the record:
CREATE SEQUENCE seq1 AS BIGINT
VALUES NEXTVAL INTO id FOR seq1
-- Artur Wronski
alexs - 31 Aug 2006 15:27 GMT
hi,
o.k. think I'm missing something here.
1).
If I've defined the primary key for a table to be auto increment then
surely you can't insert a value into it that's generated by the stored
procedure.
2). If the primary key isn't auto increment, and i generate the key
value from within a stored procedure using a create sequence statement,
what happens if I update the sp, or the instrance is restarted, If i've
got pirmary keys in the range 1 - 99 and i stop and start the database,
how does the create sequence statement know to start from 100 and not
1 ?
It sort of assumes that at some point when the sp is being initialized
you do some magic to find out what the next primary key value is and
use that to init your sequence
> alexs,
>
[quoted text clipped - 8 lines]
>
> -- Artur Wronski