I use something similar (watch where nextval/currval are used):
SELECT nextval('prodid_seq');
INSERT INTO product VALUES (currval('prodid_seq'),'...',...,'');
SELECT * FROM product WHERE prodid = (SELECT
nextval('prodid_seq'));
But there's probably a better way....
SZUCS Gábor wrote:
>>SELECT nextval('prodid_seq') as id;
>>
>>INSERT INTO product VALUES (nextval('prodid_seq'),'...',...,'');
>>
>>OK up to this point.
>>
>>Now how do I SELECT back the record I just inserted.
>>
>>SELECT * FROM product WHERE prodid = id;
>>ERROR: Attribute 'id' not found
>>
>>OK, I'm not very good at SQL yet. How do you put the sequence number in
>>a place holder, then do the insert, and finally retrieve the record you
>>just inserted by matching the prodid with the number in the place holder.
>>
>>
>
>
>
--
Ron St.Pierre
Syscor R&D
tel: 250-361-1681
email: rstpierre@syscor.com