how to insert 2 items into a table as 2 rows

Viewed 48

I know I'm not supposed to write my own insert statements. But I couldn't find how to do that with Oracle Apex built-in DML option.

I have a page with 2 text field items:

P1_ITEM_01
P2_ITEM_02

I have a table

create table mos.items (str varchar2(20));

I want to insert above 2 items' values into my table mos.items when I submit the page, as 2 rows.

q1. How can I loop the insert action?

q2. If I must write an insert statement, I'm thinking to name my items in a certain way then select them with LIKE 'P1_ITEM%' from APEX_APPLICATION_PAGE_ITEMS and create a loop for each item. Is it the right approach?

Thank you very much in advance.

1 Answers

The simplest way - from my point of view - is to create your own process which will

insert into items (str) values (:P1_ITEM_01);
insert into items (str) values (:P1_ITEM_02);

Anything else is probably possible, but almost certainly more complex than it should be.

Related