sql - Appending to an extracted file -


i have procedure extracting data edw file user in business objects use.

i use cursor select data need , run in loop follows:

for x in c_body loop  utl_file.put_line(out_file, x.data_line); end loop;    utl_file.fclose(out_file);   dbms_output.put_line('copy file ' ||lv_path||'/'||lv_filename|| ' '                               ||lv_pub_path||'/'||lv_filename);   osutil.runoscmd('cp -f '||lv_path||'/'||lv_filename||' '||lv_pub_path, lv_os_out, ln_os_num);    if ln_os_num != 0     dbms_output.put_line('copy file '||lv_filename||' failed. error = ' || lv_os_out || ' ' || ln_os_num);     raise exit_now;   end if; 

is there way can run procedure multiple times , append extracted file? running massive extract of 2 years history data , rather append multiple times smaller sets rather use full 24 months (it's going take forever).

thanks in advance

you can append file using utl_file append open mode of fopen:

open_mode: specifies how file opened. modes include:

  • r -- read text
  • w -- write text
  • a -- append text
  • rb -- read byte mode
  • wb -- write byte mode
  • ab -- append byte mode

in case write 24 (different) files can run multiple procedures simultaneously, merge result files.


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -