I have a form where an user can add a record for a customer, issue is, each customer can have multiple products. My insert (record) process basically checks if there's info added on the product items and loops for the necessary amount of times, e.g.: User adds customer ABCDE and selects 2 products, 2 records for customer ABCDE will be inserted with the 2 new products. Issue is that I can't get Apex to insert both products. I have something like this:
LOOP
V_COUNTER := V_COUNTER + 1;
EXIT WHEN V_COUNTER > V_AMOUNT_OF_PRODUCTS_COUNTER;
INSERT INTO MY_TABLE (CUSTOMER, PRODUCT)
VALUES (:P2_MY_TEXT_CUSTOMER_ITEM, :P2_PRODUCT_||V_COUNTER);
END LOOP;
If the user adds 3 products: result: 3 rows of the same customer with the same (first item) product name desired result: 3 rows of the same product with products being :P2_PRODUCT_1, :P2_PRODUCT_2 and :P2_PRODUCT_3.
Thanks