Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

plsql read wrong date cell value from excel file

Wissam AbdallahJul 20 2016 — edited Jul 20 2016

i write the flowing procedure to read an excel file having cell with format date:

  P03_IMPORT_ELCTRS_MOHAF_JBLLE  (p_file_xls in varchar2, p_sheet_xls in varchar2, nbr_of_pages in integer DEFAULT 1)
AS
result INTEGER; 

filename varchar2(255);

cell_value1_dateDATE  ;   

cell_value1_date_concat_char   varchar2(100);

BEGIN  

     filename := 'C:\Climate_File\'   ||    p_file_xls  ||   '.xls';

     result := ORDExcelSB.CreateExcelApplication('');

     result := ORDExcelSB.OpenExcelFile(filename, p_sheet_xls);   -- p_sheet_xls := 'sheet1' 

   

  cell_value1_date :=  ORDExcelSB.GetDataDate('E' || 1); 

   cell_value1_date_concat_char:=to_char(cell_value1_date, 'DD/MM/YYYY' );

   dbms_output.put_line(cell_value1_date_concat_char);

result := ORDExcelSB.ExitExcel();
EXCEPTION
WHEN OTHERS THEN
result := ORDExcelSB.ExitExcel();
RAISE;
END;


from isql plus i execute the procedure as follow

SET SERVEROUTPUT ON;

DECLARE

BEGIN

P03_IMPORT_ELCTRS_MOHAF_JBLLE ('25000_0000_010', '25000_0000_010', 1);

END;

the result of   cell_value1_date_concat_char  is : 02/08/1380  which is different to the value of the cell in excel file "25000_0000_010.xls" which is = 1/19/1961..

what can i do to let my procedure read successfully the date cell in the excel file "25000_0000_010.xls" ?

any help i appreciate it.

thank you.

This post has been answered by gaverill on Jul 20 2016
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 17 2016
Added on Jul 20 2016
13 comments
1,706 views