Home » Developer & Programmer » Application Express, ORDS & MOD_PLSQL » Insert process ORACLE APEX (Oracle Apex 19.2)
Insert process ORACLE APEX [message #680412] Wed, 13 May 2020 13:10 Go to next message
petar97
Messages: 120
Registered: October 2018
Senior Member
I created stacked master detail page with two table.

And new region with shuttle item, and button.

I created process for shuttle insert

declare

    tab apex_application_global.vc_arr2;

    begin

        tab := apex_util.string_to_table (:P2_NEW);

        for i in 1..tab.count loop

            insert into privs (fk_priv_id, fk_role_id)

            values (tab(i), :ROLE_ID);

        end loop;

    end;
:ROLE_ID - is column name
:P2_NEW - is shuttle

When I select role_id in master table and try to insert data I get error cannot insert null into fk_role_id...
When I replace :ROLE_ID with number(eg. 3) all works fine, but insert always for ROLE_ID 3 not for selected one.
What should I do to insert selected value from master table.
I can make test apex page, If you want to see code

Thanks in advance!


[Edit MC: change table and column names at OP request]

[Updated on: Sat, 04 July 2020 13:42] by Moderator

Report message to a moderator

Re: Insert process ORACLE APEX [message #681299 is a reply to message #680412] Mon, 06 July 2020 06:40 Go to previous message
petar97
Messages: 120
Registered: October 2018
Senior Member
I solved problem using LOV with shuttle(without master-detail regions)

DECLARE
    vTAB APEX_APPLICATION_GLOBAL.VC_ARR2;
BEGIN

vTAB := apex_util.string_to_table (:P2_SHUTTLE);

DELETE FROM privs WHERE fk_role_id = :P2_LOV;

FOR i IN 1 .. vTAB.count LOOP
        INSERT INTO privs (fk_priv_id, fk_role_id)
        VALUES (vTAB(i), :P2_LOV);
    END LOOP;                                                             
END;   
Previous Topic: Serving APEX images from the Oracle CDN
Next Topic: HTTP 400 - Bad request Page cannot be found while submitting tabular form
Goto Forum:
  


Current Time: Thu Mar 28 18:22:24 CDT 2024