Re: Last Insert
| От | Stephan Szabo |
|---|---|
| Тема | Re: Last Insert |
| Дата | |
| Msg-id | 20020313085715.F82814-100000@megazone23.bigpanda.com обсуждение исходный текст |
| Ответ на | Last Insert (Marcelo Pereira <gandalf@sum.desktop.com.br>) |
| Ответы |
Re: Last Insert
|
| Список | pgsql-general |
On Wed, 13 Mar 2002, Marcelo Pereira wrote:
> Hello All,
>
> I have two tables, the first is parental and the second is a child of the
> first.
>
> Ex.:
>
> create table first (id SERIAL, descrip CHAR(20));
> create table second (id INTEGER references first(id), state CHAR(2));
>
> I have `all' the values to make the inserts in the two tables (ie, descrip
> and state), so I `would' use:
>
> INSERT into first (descrip) values ($descr);
> INSERT into second (id,state) values (?????????,$state);
currval('first_id_seq') should get you the last sequence value given to
your session.
В списке pgsql-general по дате отправления: