Re: New ID

From: "Josh Berkus" <josh(at)agliodbs(dot)com>
To: "Brian Johnson" <bjohnson(at)jecinc(dot)on(dot)ca>, <pgsql-novice(at)postgresql(dot)org>
Subject: Re: New ID
Date: 2002-02-13 19:35:36
Message-ID: web-693002@davinci.ethosmedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Brian,

> What I don't know how to do is to get that newly created note_id so
> that I
> can insert it into the palm_memos table
>
> Any ideas / advice?

Easy (please taylor to your programming language):

BEGIN TRANSACTION;

INSERT INTO notes (fields)
VALUES (new stuff);

$variable = SELECT CURRVAL('name-of-sequence-for-notes_id')

INSERT INTO palm_memos (notes_id, other fields)
VALEUS ($variable, other fields);

END TRANSACTION;

Make sense?

-Josh

______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh(at)agliodbs(dot)com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco

In response to

  • at 2002-02-13 19:16:10 from Brian Johnson

Browse pgsql-novice by date

  From Date Subject
Next Message Patrick Hatcher 2002-02-13 19:48:40 Re: Function Hangs
Previous Message Patrick Hatcher 2002-02-13 19:33:21 Re: Function Hangs