Обсуждение: insert values from a ROW object

Поиск
Список
Период
Сортировка

insert values from a ROW object

От
Michael Moore
Дата:
for a in select * from temp_rslt
loop
   insert into final_rslt select row(a.*);
end loop;

I want to do something like the above. I don't want to have to name each 'a.' variable.
Is it possible?

TIA
Mike

Re: insert values from a ROW object

От
Michael Moore
Дата:
by the way, the row structure of temp_rslt and final_rslt are identical.


On Thu, Sep 22, 2016 at 2:42 PM, Michael Moore <michaeljmoore@gmail.com> wrote:
for a in select * from temp_rslt
loop
   insert into final_rslt select row(a.*);
end loop;

I want to do something like the above. I don't want to have to name each 'a.' variable.
Is it possible?

TIA
Mike

Re: insert values from a ROW object

От
"David G. Johnston"
Дата:
On Thu, Sep 22, 2016 at 2:42 PM, Michael Moore <michaeljmoore@gmail.com> wrote:
for a in select * from temp_rslt
loop
   insert into final_rslt select row(a.*);
end loop;

I want to do something like the above. I don't want to have to name each 'a.' variable.
Is it possible?


INSERT INTO final_rslt VALUES ( (a).* );

David J.

Re: insert values from a ROW object

От
Thomas Kellerer
Дата:
Michael Moore schrieb am 22.09.2016 um 23:42:
> for a in select * from temp_rslt
> loop
>    insert into final_rslt select row(a.*);
> end loop;
>
> I want to do something like the above. I don't want to have to name each 'a.' variable.
> Is it possible?
>

No need for a loop:
  insert into final_rsl  select *  from tmp_rslt;

This assumes that both table define the columns in the exact same order








Re: insert values from a ROW object

От
Michael Moore
Дата:
Thanks David.
Thomas, Yes, in my example the loop is not necessary, but in my real application it is. :-) Thanks.

On Thu, Sep 22, 2016 at 2:55 PM, David G. Johnston <david.g.johnston@gmail.com> wrote:
On Thu, Sep 22, 2016 at 2:42 PM, Michael Moore <michaeljmoore@gmail.com> wrote:
for a in select * from temp_rslt
loop
   insert into final_rslt select row(a.*);
end loop;

I want to do something like the above. I don't want to have to name each 'a.' variable.
Is it possible?


INSERT INTO final_rslt VALUES ( (a).* );

David J.