OUTER join?

Hi,
I have a code where it traverses through each record froma table and creates records in another table. I use FOREACH cursor to do this, i'm using another cursor inside the FOREACH to fetch the details of other table. Please suggest me which would be more efficient, as this will run against millions of records, i have to make it efficient as much as i can.

--pseudo--
source tables - a, b
target table - c

code 1-
cursor a;
cursor b;
FOREACH a
fetch cursor b
insert to table c
END FOREACH

code 2-
cursor a {table a OUTER table b}
FOREACH a
insert to table c
END FOREACH

Thanks!

what exactly are you trying to do logically? what DBMS?

I'd *NEVER* go for this cursor (row-by-row) insert if the data set is millions of records.

I'd rather do this -

INSERT INTO c <column_list>
SELECT <column_list>
FROM a OUTER JOIN b
WHERE <predicates>;

And depending on the database, check for usage of hints/compiler directives, take into account undo segments, indexes, triggers etc.

tyler_durden