Home » Developer & Programmer » Forms » Doubt in The code- Which exports the data to the excel sheet.
Doubt in The code- Which exports the data to the excel sheet. [message #383362] Wed, 28 January 2009 08:51 Go to next message
SUHAS22845
Messages: 51
Registered: August 2008
Location: BANGALORE
Member

Hi Friends,

I have written a piece of code, which actually exports the records to excel sheet, i.e, ".XLS" format. I am getting an error when the row between message(5) and message(6) is getting processed. I mean, the file which gets created, when we want to open it in 'Write' Mode, at that time, an error message

From-40735: When Button Pressed Trigger Raised, caused unhandled Exception ORA-302000
Like this is coming up. Please any one help me out on this.

The code is as below.
/* Formatted on 2009/01/29 17:27 (Formatter Plus v4.8.0) */
PROCEDURE PR_EXCEL_DOWNLOAD_DETAILS IS
  filename          varchar2 (3000);
  ofile             text_io.file_type;
  v_title           varchar2 (250);
  v_physical_path   varchar2 (75);
  v_web_path        varchar2 (100);
  v_server_name     varchar2 (20);
begin
  begin
    message ('1');
    select physical_path, web_path
      into v_physical_path, v_web_path
      from sis_server_path, global_name
     where server_name = substr (global_name, 1, 4);
    message ('2');
  exception
    when no_data_found then
      message ('Server Path Not Found');
    when others then
      message (sqlerrm);
  end;
  message ('3');
  set_application_property (cursor_style, 'busy');
  message ('4');
  FileName  := 'system_access_'
               || userenv ('sessionid')
               || '_'
               || to_char (sysdate, 'ddhhmiss')
               || '.xls';
  message ('5');
  ofile     := text_io.fopen (lower ('E:\10g_forms\excel\' || filename), 'W');
--ofile:=text_io.fopen(lower(v_physical_path||'filename'),'W');
  message ('6');
  --v_title:=' The Reports are : '||:blk_parent.org_sis_id||' ('||:blk_parent.node_descr||')';
  text_io.put_line (ofile, v_title);
  message ('7');
  text_io.put_line (ofile, ' ');
  message ('8');
  text_io.put_line (ofile,
                    'OPERATION'
                    || chr (9)
                    || 'Node description'
                    || chr (9)
                    || 'Science Direct');
  message ('9');
  go_block ('AUDIT_JOURNAL_PRICES');
  first_record;
  message ('10');
  loop
    text_io.put_line (ofile,
                      :AUDIT_JOURNAL_PRICES.OPERATION
                      || chr (10)
                      || :AUDIT_JOURNAL_PRICES.USERNAME
                      || chr (20)
                      || :AUDIT_JOURNAL_PRICES.ACTION_DATE);
    exit when :system.last_record = 'TRUE';
    next_record;
  end loop;
  message ('11');
  first_record;
  text_io.fclose (ofile);
  message ('12');
  web.show_document ('http://145.36.149.126:8889/forms90/excel/' || filename,
                     '_blank');
--web.show_document(v_web_path||filename,'_blank');
  message ('13');
  set_application_property (cursor_style, 'DEFAULT');
  message ('14');
end;



Please help me out on this.
[EDITED by DJM: remove superfluous tabs][Crap! Reformatted it all.]

[Updated on: Thu, 29 January 2009 00:28] by Moderator

Report message to a moderator

Re: Doubt in The code- Which exports the data to the excel sheet. [message #383485 is a reply to message #383362] Thu, 29 January 2009 00:29 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
No you are not getting the error on that line. You MUST have a 'pause' or a 'synchronize' after the 'message' command.

David
Previous Topic: How to Show Client machine name in Oracle Forms10G
Next Topic: I want to know the sample code to use mscomm.ocx
Goto Forum:
  


Current Time: Sun Feb 09 10:10:15 CST 2025