Skip to Main Content

APEX

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!

upload and insert xlsx file into table

Fabrizio Delli PriscoliDec 18 2019 — edited Dec 18 2019

Hi all, I'm on APEX 19.2.

I want to become more familiar with uploading and inserting xlsx files into my tables.

So I have installed in my workspace "Data Load App" from app gallery.

I have created a copy of EMP table, called backup_emp.

I'm able to upload xlsx file and I have the preview.

But i receive error when I try to insert records into table.

Here is the code of my button for insert records and I'm trying to insert one column per time...

The error is:

ORA-01722: invalid number. How can I solve this?

I followed all the steps indicated here: https://blogs.oracle.com/apex/super-easy-csv-xlsx-json-or-xml-parsing-about-the-apex_data_parser-package

Thanks for collaboration,

Fabrizio

declare

   

cursor c1 is

select line_number, col001, col002, col003, col004, col005,

                            col006, col007, col008

          from apex_application_temp_files f,

               table( apex_data_parser.parse(

                          p_content                     => f.blob_content,

                          p_add_headers_row             => 'N',

                          p_max_rows                    => 50,

                          p_store_profile_to_collection => 'FILE_PARSER_COLLECTION',

                          p_file_name                   => f.filename ) ) p

                          where f.name = :P0_NOME_FILE_EXCEL;

begin

    for c1rec in c1 loop

        insert into backup_emp (empno)

        values

        (to_number(c1rec.col001));       

    end loop;

commit;

end;

This post has been answered by Veerendra Patil on Dec 18 2019
Jump to Answer
Comments
Post Details
Added on Dec 18 2019
2 comments
545 views