psql - user defined SQL variables

From: Grainne Reilly <greilly1(at)comcast(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: psql - user defined SQL variables
Date: 2004-08-18 04:22:27
Message-ID: 6.0.3.0.0.20040817233150.00b233a8@mail.comcast.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I am new to PostgreSQL and am porting some scripts written for MySQL over
to psql. There is one MySQL feature which I cannot find in psql - user
defined SQL variables. In MySQL I can use these to hold the result
(numeric, string or null) of a select: e.g.
select @count = count(*) from mytable;
The @count variable now holds the result of that select, and I can use it
in where clauses, updates, inserts etc.
I checked out the \set psql variable but I haven't found a way to tweak it
to give me the result of a sql statement - is there any way to do that (I'm
using PostgreSQL version 7.4.3)?
Thanks in advance for any suggestions,
Grainne.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tino Wildenhain 2004-08-18 05:28:17 Re: psql - user defined SQL variables
Previous Message Scott Marlowe 2004-08-18 04:03:13 Re: Any recommended forums/wiki/blog s/w that uses