Scope Problem with Execute?

Поиск
Список
Период
Сортировка
От Rob Storrs
Тема Scope Problem with Execute?
Дата
Msg-id p4CcnXS6LrS_re-jXTWcqQ@speakeasy.net
обсуждение исходный текст
Список 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


В списке pgsql-general по дате отправления:

Предыдущее
От: James Hall
Дата:
Сообщение: Re: Pg_hba not using local setting
Следующее
От: Clarence Gardner
Дата:
Сообщение: dropped columns