From: | "Gauthier, Dave" <dave(dot)gauthier(at)intel(dot)com> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | setting and using variables in PSQL ???? |
Date: | 2007-12-15 03:19:07 |
Message-ID: | D7FF158337303A419CF4A183F48302D603782B11@hdsmsx411.amr.corp.intel.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi:
At the PSQL prompt, I want to set some variables based upon query
results, or via static assignment, then insert a record with those
values. Sort of like...
select val1 into x from agedata where name = 'joe_mako';
select val12 into y from sizedata where name = 'joe_mako';
thename := 'joe_mako';
insert into newtable (name, age, height) values (thename,x,y);
Some sort of compound insert statement would solve my problem, but in a
larger sense, how do you (can you ) do something like this inside a
statement blocks of some kind? I've done some PL-pgsql and know about
statement blocks in that context. But I don't want to have to create a
function, use it, then delete it. Was wondering of something else could
be done.
Thanks
-dave
From | Date | Subject | |
---|---|---|---|
Next Message | Nathan Wagner | 2007-12-15 03:53:34 | Re: setting and using variables in PSQL ???? |
Previous Message | Adrian Klaver | 2007-12-15 03:02:04 | Re: Finding bad bye in "invalid byte sequence" error |