Re: [GENERAL] Looking for help regarding getting the latest inserted sequence value.

2007-07-01 Thread Martijn van Oosterhout
On Sat, Jun 30, 2007 at 11:21:59AM -0700, Richard Broersma Jr wrote: > I don't want to derail the thread too much, but would it be nice if the > returning could be used in > a insert sub-query? Absolutly, however the semantics are not so simple. I remember something about when to invoke triggers?

Re: [GENERAL] Looking for help regarding getting the latest inserted sequence value.

2007-06-30 Thread Richard Broersma Jr
--- Magnus Hagander <[EMAIL PROTECTED]> wrote: > If you're on 8.2 the easiest way is to use INSERT RETURNING. For example: > INSERT INTO t (somefield) VALUES ('somevalue') RETURNING pkey > > with pkey being the SERIAL field. I don't want to derail the thread too much, but would it be nice if th

Re: [GENERAL] Looking for help regarding getting the latest inserted sequence value.

2007-06-30 Thread Magnus Hagander
Mavinakuli, Prasanna (STSD) wrote: > Hello All, > > We are looking for your help.The scenarion which we need to address > is,There are 2 threads and both of them are in separate transction and > insert the value to a same table and also sequence number field gets > incremented automotically for ea

Re: [GENERAL] Looking for help regarding getting the latest inserted sequence value.

2007-06-29 Thread Jan de Visser
On Thursday 28 June 2007 01:31:33 Mavinakuli, Prasanna (STSD) wrote: > .And getting the max(id) from the table. Instead of that, use select currval('sequence'). currval will " Return the value most recently obtained by nextval for this sequence in the current session. (An error is reported if n

[GENERAL] Looking for help regarding getting the latest inserted sequence value.

2007-06-29 Thread Mavinakuli, Prasanna (STSD)
Hello All, We are looking for your help.The scenarion which we need to address is,There are 2 threads and both of them are in separate transction and insert the value to a same table and also sequence number field gets incremented automotically for each of them.The problem we are facing is,We will