From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Keala Jacobs <keala_jacobs(at)itd(dot)sterling(dot)com> |
Cc: | pgsql-hackers(at)hub(dot)org |
Subject: | Re: [HACKERS] variables in psql |
Date: | 1999-06-01 21:26:09 |
Message-ID: | 23775.928272369@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Keala Jacobs <keala_jacobs(at)itd(dot)sterling(dot)com> writes:
> Does postgres support the use of variables as in the example below?
> update table1 set column1=(at)variable
> where column2='text4column2'
> and @variable=(select column3 from table2 where column4='text4column4');
> If not, how do I execute a statement like this in postgres?
That isn't a particularly compelling example, since it looks like what
you mean is the same as
update table1 set column1 = table2.column3
where table1.column2 = 'text4column2' and table2.column4 = 'text4column4';
I have seen examples where it'd be nice to have an SQL variable that
could hold a value from one statement to the next; currently you have
to do that with a temporary table, which seems rather cumbersome...
BTW, I think this'd be more appropriate in pgsql-sql.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 1999-06-01 21:52:34 | Re: [HACKERS] Re: [SQL] Column name's length |
Previous Message | Keala Jacobs | 1999-06-01 20:14:05 | variables in psql |