Skip site navigation (1) Skip section navigation (2)

PLSQL Question regarding multiple inserts

From: "Humble Geek" <humblegeek(at)rogers(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: PLSQL Question regarding multiple inserts
Date: 2004-02-25 03:56:22
Message-ID: G1V_b.53$ (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
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

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.




pgsql-sql by date

Next:From: Jonathan M. GardnerDate: 2004-02-25 08:19:29
Subject: Re: [HACKERS] [SQL] Materialized View Summary
Previous:From: Jonathan GardnerDate: 2004-02-24 22:19:39
Subject: Re: [HACKERS] [SQL] Materialized View Summary

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group