From: | Rob Storrs <pgrstorrs(at)truepricing(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Scope Problem with Execute? |
Date: | 2003-03-14 19:40:18 |
Message-ID: | p4CcnXS6LrS_re-jXTWcqQ@speakeasy.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I have encountered what I think is a scoping problem with an EXECUTE
statement.
for test_record in select * from source_table
LOOP
for i in 0..9 loop
column_name := ''test_record.field_''||i;
insert_str := ''insert into output_table (output)
values (''||column_name||'')'';
execute insert_str;
end loop;
end loop;
I keep getting errors about not being able to find "test_record".
I can't find the right syntax so that the execute command can reference
the record (test_record). I've tried wrapping column_name in
quote_ident(), pulling out test_record into the insert_str literal,
splitting the record.field and quote_ident() both of them.
Any help would be greatly appreciated. Postgresql 7.2.3 on RedHat Linux
7.2 on Intel.
Thanks.
~Rob Storrs
From | Date | Subject | |
---|---|---|---|
Next Message | Clarence Gardner | 2003-03-14 19:49:04 | dropped columns |
Previous Message | James Hall | 2003-03-14 19:19:04 | Re: Pg_hba not using local setting |