pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Humble Geek <humblegeek@rogers.com>
To: pgsql-sql@postgresql.org
Subject: PLSQL Question regarding multiple inserts
Date: Wed, 25 Feb 2004 03:56:22 GMT
Message-ID: <G1V_b.53$Yf.7@twister01.bloor.is.net.cable.rogers.com> (raw)

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





view thread (2+ messages)  latest in thread

Message-ID: <G1V_b.53$Yf.7@twister01.bloor.is.net.cable.rogers.com>
Permalink:  ../G1V_b.53$Yf.7@twister01.bloor.is.net.cable.rogers.com/
Also on:    postgresql.org/message-id/G1V_b.53$Yf.7@twister01.bloor.is.net.cable.rogers.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: humblegeek@rogers.com
  Subject: Re: PLSQL Question regarding multiple inserts
  In-Reply-To: <G1V_b.53$Yf.7@twister01.bloor.is.net.cable.rogers.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox