hendra kusuma wrote: > > Let me get this clear > it should looks like this? > > create function something() returns integer as $$ > declare > ret integer; > begin > -- just assume something table has a serial column as primary key > insert into something values ('a value'); > select currval('something_sequence') into ret; > return ret; > end > > $$ language 'plpgsql'; That should work fine, although for that particular case with recent versions you could just use: INSERT INTO some_table (id, mytext) VALUES (DEFAULT, 'a value') RETURNING id; -- Richard Huxton Archonet Ltd -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general