Cursor to CSV
899582Nov 11 2011 — edited Nov 14 2011I have a select query (or a cursor) that i want to use and generate a excel file.
i defined as a ref cursor
pio_cstdn_extract_cur IN OUT custodian_cursor_type) IS
select script at v_chr_sql is working but at fetch (fetch pio_cstdn_extract_cur bulk collect into l_c1, l_c2, l_c3 limit l_limit;) I get Exception
OPEN pio_cstdn_extract_cur FOR v_chr_sql;
loop
fetch pio_cstdn_extract_cur bulk collect into l_c1, l_c2, l_c3 limit l_limit;
for i in 1 .. l_c1.count
loop
dbms_output.put_line( l_c1(i) || ',' || l_c2(i) || ',' || l_c3(i) );
end loop;
exit when pio_cstdn_extract_cur%notfound;
end loop;
close pio_cstdn_extract_cur;