Re: Variables in Postgresql

From: Jonathan Bartlett <johnnyb6(at)sdf(dot)lonestar(dot)org>
To: Tomas Eriksson <tomas(at)embryo(dot)se>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Variables in Postgresql
Date: 2001-06-11 18:02:50
Message-ID: Pine.LNX.4.21.0106111802390.30070-100000@sdf.lonestar.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

You could use a temporary table.

Jon

johnnyb6(at)sdf(dot)lonestar(dot)org
SDF Public Access UNIX System - http://sdf.lonestar.org

On Mon, 4 Jun 2001, Tomas Eriksson wrote:

> 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
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Farid Hajji 2001-06-11 18:46:02 numeric type in user-programs (needing numeric API?)
Previous Message Tim Barnard 2001-06-11 18:00:36 Odd behavior with LIKE?