X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id BAF68D1D4E7 for ; Wed, 25 Feb 2004 04:19:16 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 14771-05 for ; Wed, 25 Feb 2004 00:19:12 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 3B113D1D286 for ; Wed, 25 Feb 2004 00:19:12 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i1P4JB1Y032021 for ; Wed, 25 Feb 2004 04:19:11 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i1P3uIPO028197 for pgsql-sql@postgresql.org; Wed, 25 Feb 2004 03:56:18 GMT From: "Humble Geek" X-Newsgroups: comp.databases.postgresql.sql Subject: PLSQL Question regarding multiple inserts Lines: 21 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Message-ID: Date: Wed, 25 Feb 2004 03:56:22 GMT X-Complaints-To: abuse@rogers.com To: pgsql-sql@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/400 X-Sequence-Number: 17090 Hi all. Quick and perhaps silly question, but... I am using Pg 7.3. I am writing a function using pgplsql. This function will perform multiple inserts. Let's say two of the inserts are as follows: -- id is primary key insert into users (id, username) values (nextval('someSeq'),'somename'); -- id is also a PK insert into log (id, uid, message) values (nextval('someOtherSeq'),XXX,'New Account'); Assume XXX is the id from the first insert. How do I get that number? Not currval('someSeq') - 'cause someone else may have performed an insert - but the id for that specific insert. Thanks, HG