Hi,
I am working on a process where I want to store the temporary results in an associative array. At the end of the process I plan to write the contents of the array into a table that has the same structure. (the array is defined as a %rowtype of the table)
Is it possible to execute ONE sql statement that transfers the array into the table? I am on 10g (10.2.0.4.0)
Here's what I have now:
declare
type t_emp is table of emp%rowtype index by pls_integer;
v_emp t_emp;
begin
-- [..
-- a process that fills v_emp with lots of data
-- ..]
for i in v_emp.first .. v_emp.last
loop
insert into emp values v_emp(i);
end loop;
end;
But it would be better if the loop could be replaced by sql one statement that inserts all of v_emp into emp. Is that possible?
Thanks!
PS: I'm not sure whether it's a good idea to use this approach... building a table in memory and inserting it into the database at the end of the process. Maybe it's better to insert every record directly into the table... but in any case I'm curious to see if it is possible in theory :)
Edited: Added version info