From: | Dustin Sallings <dustin(at)spy(dot)net> |
---|---|
To: | Mirko Geffken <mgeffken(at)corcoranweb(dot)com> |
Cc: | pgsql-general(at)hub(dot)org |
Subject: | Re: Question reagarding serial type. |
Date: | 2000-06-14 04:26:46 |
Message-ID: | Pine.NEB.4.10.10006132118020.284-100000@foo.west.spy.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, 8 Jun 2000, Mirko Geffken wrote:
# i have tried to find info elsewhere, but did not find anything to my
# satisfaction, so I was wondering if anyone on this list could point me
# into the right direction.
#
# When I create a table
#
# e.g.:
# create table xyz
# (
# id serial PRIMARY KEY,
# uvw varchar2(100)
# );
#
# I would like to get the id returned when I insert into this table. In
# oracle it is possible to do this: insert into xyz(uvw) values ('Test')
# returning id;
What if you had two serials? I guess that's not terribly likely.
# How can I do this with SQL in Postgres. Any ideas.
insert into xyz(uvw) values ('Test');
INSERT 18968479 1
dustin=# select currval('xyz_id_seq');
currval
---------
1
(1 row)
--
dustin sallings The world is watching America,
http://2852210114/~dustin/ and America is watching TV.
From | Date | Subject | |
---|---|---|---|
Next Message | selkovjr | 2000-06-14 07:00:46 | Re: Size Limit |
Previous Message | Marc Tardif | 2000-06-14 04:08:01 | Re: Size Limit |