PL/SQL Dynamic Content

 PROCEDURE prc_spreadsheet IS

  
  CURSOR c_reprice_data IS
    SELECT * FROM
    tbl_repricing_table
    ORDER BY ID desc;

  BEGIN
    owa_util.mime_header('application/octet-stream', FALSE);
    htp.p('Content-Disposition: attachment; filename=system_query_results_'||
to_char(sysdate, 'MM')||'-'||to_char(sysdate, 'DD')||'-'||
to_char(sysdate, 'YYYY')||'.xls');
    owa_util.http_header_close;
    
      htp.prn('ID'||chr(9));
      htp.prn('Date Created'||chr(9));
      htp.prn('User Created'||chr(9));
      htp.prn('Hot Rush?'||chr(9));
      htp.prn('Order #'||chr(9));
      htp.prn('Bill to #'||chr(9));
      htp.prn('Bill to Name'||chr(9));
      htp.prn('Trade'||chr(9));
      htp.prn('Comments'||chr(9));
      htp.prn('Pricing Analyst'||chr(9));
      htp.prn('Status'||chr(9));
      htp.prn('Line Count'||chr(9));
      htp.prn('User Completed'||chr(9));
      htp.prn('Date Submitted');
      htp.prn(chr(13));
    FOR r_reprice_data IN c_reprice_data LOOP
      htp.prn(r_reprice_data.id||chr(9));
      htp.prn(r_reprice_data.date_created||chr(9));
      htp.prn(r_reprice_data.user_created||chr(9));
      htp.prn(r_reprice_data.hot_rush||chr(9));
      htp.prn(r_reprice_data.order_number||chr(9));
      htp.prn(r_reprice_data.bill_to_number||chr(9));
      htp.prn(r_reprice_data.bill_to_name||chr(9));
      htp.prn(r_reprice_data.trade||chr(9));
      htp.prn(fnc_format_long_text(r_reprice_data.comments)||chr(9));
      htp.prn(r_reprice_data.pricing_analyst||chr(9));
      htp.prn(r_reprice_data.status||chr(9));
      htp.prn(r_reprice_data.line_count||chr(9));
      htp.prn(r_reprice_data.user_completed||chr(9));
      htp.prn(r_reprice_data.date_submitted);
     
      htp.prn(chr(13));
    
    END LOOP;

  END prc_spreadsheet;

END repricing;

Comments

Popular posts from this blog

Project Management System ER Diagram

Install and Configure OBIEE 12c on Linux VM

Web Based Hotel Room Management Information System