Chris Smith said:
The only other approach is to
> use
> some unique set of columns in the table other than your numeric key, and
> immediately follow your insert statement with a select. This only works
> if
> your records are unique without regard to the generated key. As an
> example,
> you'd do:
>
> insert into mytable (name, department, position, hiredate)
> values('jdoe', 'eng', 'manager', DATE '10-12-1994');
>
> select empid from mytable where
> name = 'jdoe' AND
> department = 'eng' AND
> position = 'manager' AND
> hiredate = DATE '10-12-1994';
>
Alternatively, if you could use a sequence object for the primary key
value (instead of a serial column), and you switched autocommit off, you
should be able to determine the last allocated PK id AFTER creating the
record by querying the currval on the sequence.
John Sidney-Woollett