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 EDEDFD1D26D for ; Mon, 1 Mar 2004 03:59:08 +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 72455-06 for ; Sun, 29 Feb 2004 23:59:05 -0400 (AST) Received: from ndl1mr1-a-fixed.sancharnet.in (ndl1mr1-a-fixed.sancharnet.in [61.0.0.45]) by svr1.postgresql.org (Postfix) with ESMTP id 59FAAD1C9CF for ; Sun, 29 Feb 2004 23:58:58 -0400 (AST) Received: from conversion-daemon.ndl1mr1-a-fixed.sancharnet.in by ndl1mr1-a-fixed.sancharnet.in (iPlanet Messaging Server 5.2 HotFix 1.17 (built Jun 23 2003)) id <0HTV00J01PK8RM@ndl1mr1-a-fixed.sancharnet.in> for pgsql-sql@postgresql.org; Mon, 01 Mar 2004 09:29:01 +0530 (IST) Received: from sancharnet.in ([61.0.95.105]) by ndl1mr1-a-fixed.sancharnet.in (iPlanet Messaging Server 5.2 HotFix 1.17 (built Jun 23 2003)) with ESMTPA id <0HTV00FB4PQAFF@ndl1mr1-a-fixed.sancharnet.in>; Mon, 01 Mar 2004 09:29:01 +0530 (IST) Date: Mon, 01 Mar 2004 09:47:50 +0530 From: "V i s h a l Kashyap @ [Sai Hertz And Control Systems]" Subject: Re: PLSQL Question regarding multiple inserts In-reply-to: To: Humble Geek Cc: pgsql-sql@postgresql.org Reply-To: aspire420@hotpop.com Message-id: <4042B96E.5080808@sancharnet.in> Organization: Sai Hertz And Control Systems Pvt Ltd MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7BIT X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 0.5 (Windows/20040207) References: X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/408 X-Sequence-Number: 17098 Dear Humble Geek , >-- 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 > > Nop, If the insert and later on currval('someSeq') is called inside the same function currval will only return the current value that has been effected by the first insert made. -- Best Regards, Vishal Kashyap Director / Lead Developer, Sai Hertz And Control Systems Pvt Ltd, http://saihertz.rediffblogs.com Jabber IM: vishalkashyap@jabber.org ICQ : 264360076 Yahoo IM: mailforvishal@yahoo.com ----------------------------------------------- You yourself, as much as anybody in the entire universe, deserve your love and affection. - Buddha --------------- pgsql=# select marital_status from vishals_life; marital_status ------------------ Single not looking 1 Row(s) affected ___ //\\\ ( 0_0 ) ----------------o0o-----o0o---------------------