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!

APEX_DATA_PARSER - Process for Insert multiple sheets

RobinRajFeb 13 2020 — edited Feb 14 2020

Hi Team,

I'm trying to insert XLSX data to oracle tables. Used apex_data_parser through the link "https://blogs.oracle.com/apex/super-easy-csv-xlsx-json-or-xml-parsing-about-the-apex_data_parser-package ". But I can't able to insert the records into tables.

Apex Process:

declare

l\_row\_1 sample\_demo\_1%rowtype;

l\_row\_2 sample\_demo\_2%rowtype;

l\_blob BLOB; 

begin

if :P2_SHEETS = 'sheet1.xml' then

insert into sample_demo_1 (id,first_name,last_name,phone,email,salutation,title)

(

    select line\_number, col001, col002, col003, col004, col005,

                        col006

      from apex\_application\_temp\_files f,

           table( apex\_data\_parser.parse(

                      p\_content                     => f.blob\_content,

                      p\_skip\_rows                   => 1,

                      p\_xlsx\_sheet\_name             => :P2\_SHEETS,

                      p\_file\_type                   => apex\_data\_parser.c\_file\_type\_xlsx,

                      p\_store\_profile\_to\_collection => 'FILE\_PARSER\_COLLECTION',

                      p\_file\_name                   => f.filename ) ) p

     where f.name = :P2\_UPLOAD

);

elsif :P2\_SHEETS = 'sheet2.xml' then

insert into sample\_demo\_2 (id,first\_name,last\_name,phone,email,salutation,title)

(

    select line\_number, col001, col002, col003, col004, col005,

                        col006

      from apex\_application\_temp\_files f,

           table( apex\_data\_parser.parse(

                      p\_content                     => f.blob\_content,

                      p\_skip\_rows                   => 1,

                      p\_xlsx\_sheet\_name             => :P2\_SHEETS,

                      p\_file\_type                   => apex\_data\_parser.c\_file\_type\_xlsx,

                      p\_store\_profile\_to\_collection => 'FILE\_PARSER\_COLLECTION',

                      p\_file\_name                   => f.filename ) ) p

     where f.name = :P2\_UPLOAD

);

end if;

end;

When Button Pressed - SUBMIT

Note:

P2_Upload - File Browse Item

P2_Sheets - Sheet Name [ Values taken from Apex Session ]

![Snip_1.PNG](https://objectstorage.us-phoenix-1.oraclecloud.com/p/BqK85Rn1zA5MP0vYiqbAdPgs7Z6OmMxw8SD3WCFVm5kY8uReidZ1KPIKkgJ1hCkG/n/axciphqpnohg/b/forums-legacy/o/uploads/jive_attachments/0/9/1/09126854egami.png)![Snip_2.PNG](https://objectstorage.us-phoenix-1.oraclecloud.com/p/BqK85Rn1zA5MP0vYiqbAdPgs7Z6OmMxw8SD3WCFVm5kY8uReidZ1KPIKkgJ1hCkG/n/axciphqpnohg/b/forums-legacy/o/uploads/jive_attachments/8/4/2/84226854egami.png)![Snip_3.PNG](https://objectstorage.us-phoenix-1.oraclecloud.com/p/BqK85Rn1zA5MP0vYiqbAdPgs7Z6OmMxw8SD3WCFVm5kY8uReidZ1KPIKkgJ1hCkG/n/axciphqpnohg/b/forums-legacy/o/uploads/jive_attachments/9/4/2/94226854egami.png)

Apex Version : 19.1

Please provide your valuable inputs.

Thanks,

Robin.

This post has been answered by Pavel_p on Feb 14 2020
Jump to Answer
Comments
Post Details
Added on Feb 13 2020
4 comments
1,165 views