I'm trying to build a package with a procedure which takes .XLSX file, parse and insert to a table in database.
What I have achieved so far is the code below:
create or replace package body pkg_name
is
procedure fetch_and_insert_data
is
l_display varchar2(32767);
l_id varchar2(32767);
l_filename varchar2(100) := 'my_file.xlsx';
v_file UTL_FILE.FILE_TYPE;
begin
execute immediate 'create or replace directory XOBJ as ''' || c_file_dir || '''';
v_file := UTL_FILE.FOPEN(location => 'XOBJ',
filename => l_filename,
open_mode => 'r',
max_linesize => 32767);
loop
begin
UTL_FILE.GET_LINE(v_file,l_id);
dbms_output.put_line(l_id);
EXCEPTION
WHEN NO_DATA_FOUND THEN
EXIT;
end;
end loop;
UTL_FILE.FCLOSE(v_file);
EXCEPTION
WHEN OTHERS THEN
UTL_FILE.FCLOSE(v_file);
RAISE;
end fetch_and_insert_data;
end;
But when I run it it's encoded .
PK!bîha[Content_Types].xml ¢( ¬”MOÃ0†ïHü‡WÔfã€Z·G˜Äø¡q×hiÅÞØþ=nö!„ʦ‰]µ±ß÷‰kg4Y·6[ADã])†Å@d௛—âcö’ß‹I9¬wPŠ
How can I decode and maintain my line as it is in XLSX file? Tried with CSV file and works perfectly but i need to use XLSX files.
Also tried other external packages found online and didn't helped.