Variables in Postgresql

From: "Tomas Eriksson" <tomas(at)embryo(dot)se>
To: pgsql-general(at)postgresql(dot)org
Subject: Variables in Postgresql
Date: 2001-06-04 15:43:12
Message-ID: 9fgaha$2409$1@news.tht.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi.

I haven't seen any documentation about this, how do you use variables in a
simple way in postgresql? I want to use same sequence number in a dynamic
query from Perl.

When i'm using MSSQL i can do like this in a single query

"DECLARE @owner INT
INSERT maintable (fields) VALUES (...)
SELECT @owner = @@IDENTITY
INSERT subtable (fields) VALUES (@owner, ...)"

How does I save a value and using it later in the query..?

kind regards
Tomas

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Lee Kwok Shing 2001-06-04 15:43:18 PostgreSQL hangs when INSERT/UPDATE
Previous Message Daniel A. Melo 2001-06-04 15:30:22 problem with Timestamp