OID stuff

Поиск
Список
Период
Сортировка
Искать

OID stuff

От:
Derek Clarkson <dhc@bigpond.net.au>
Дата:
Ahh,
	Thanks guys. I think I have it now. I've also been looking for a way to get 
the id of a newly created record. Using MS SQL (pha! blah! cough! ;-) I could 
use the scope_identity function to get the id of the record I have just 
created for placing in foreign keys in subsequent inserts in other tables. 

In Postgres, I have to use the 'get diagnostics var = result_oid' statement to 
get the oid of the new record, then do a select on the table to get the 
sequence column value for the new record using this oid, to obtain the new 
sequence value. 

Is this the best way to do this ?

cio
-- 
Derek Clarkson
Web: http://users/bigpond/net/au/drekka

Re: OID stuff

От:
Josh Berkus <josh@agliodbs.com>
Дата:

Derek,

> In Postgres, I have to use the 'get diagnostics var = result_oid' statement 
to 
> get the oid of the new record, then do a select on the table to get the 
> sequence column value for the new record using this oid, to obtain the new 
> sequence value. 

Um, what's wrong with "select currval('sequence_name')" ?

-- 
-Josh Berkus
 Aglio Database Solutions
 San Francisco


Re: OID stuff

От:
Derek Clarkson <dhc@bigpond.net.au>
Дата:
Doh! of course. Thanks.

On Thursday 30 January 2003 10:17, you wrote:
> Derek,
>
> > In Postgres, I have to use the 'get diagnostics var = result_oid'
> > statement
>
> to
>
> > get the oid of the new record, then do a select on the table to get the
> > sequence column value for the new record using this oid, to obtain the
> > new sequence value.
>
> Um, what's wrong with "select currval('sequence_name')" ?

-- 
Derek Clarkson
Web: http://users/bigpond/net/au/drekka

FAQ