Re: PLSQL Question regarding multiple inserts - Mailing list pgsql-sql

From V i s h a l Kashyap @ [Sai Hertz And Control Systems]
Subject Re: PLSQL Question regarding multiple inserts
Date
Msg-id 4042B96E.5080808@sancharnet.in
Whole thread Raw
In response to PLSQL Question regarding multiple inserts  ("Humble Geek" <humblegeek@rogers.com>)
List pgsql-sql
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---------------------



pgsql-sql by date:

Previous
From: Michael Chaney
Date:
Subject: Re: User defined types -- Social Security number...
Next
From: "Iain"
Date:
Subject: Re: How to get Rows Count