Step-1 :
Create Interactive Grid (table-1-----)
Step-2 :
Create Interactive Grid (table-2-----)
Step-3 : Select ID (table_1 PK column)
Type : Display Only
Target :
--> Type : URL
--> URL : #
Link Text : Chose your button "Apex Icon"
https://apex.oracle.com/pls/apex/apex_pm/r/ut/icons
Step-4 :
Create a New Item in DEPT_1 Region
Item Name : P99_NEW (You can Hidden this Item)
Step-5 : Select ID (PK column in DEPT_1 Table) And Create Dynamic Action
Action Name : Save_Button
Event : Click
Selection Type : Column(s)
--> True :
Action : Execute Server-side Code
Set Type : PL/SQL
PL/SQL Code :
declare
v_count number;
Begin
SELECT COUNT(DEPTNO_2) DEPTNO into v_count FROM DEPT_2 where DEPTNO_1=:DEPTNO ;
if v_count = 0 then
insert into DEPT_2 (
DEPTNO_2,
DNAME_2,
LOC_2,
DEPTNO_1 --- DEPT_1 Table PK Column
)
VALUES ( --- This value DEPT_1 Table all column's
SEQ_DEPT_2.NEXTVAL, --- Sequence for DEPT_2 Table PK insert
:DNAME, --- DEPT_1 COLUMN NAME
:LOC, --- DEPT_1 COLUMN NAME
:DEPTNO --- DEPT_1 COLUMN NAME
);
else
raise_application_error(-20111,'You can not add more the one!');
end if;
end;
--> Items to Submit : DEPTNO,DNAME,LOC --- (table-1 column all Name's)
***Again Action Create.
--> True :
Action : Set Value
Set Type : SQL Statment
SQL Statment : Select :DEPTNO from dual
Items to Submit : DEPTNO
Affected Elements :
--> Selection Type : Item(s)
--> Item(s) : P99_NEW
***Again Action Create.
--> True :
Action : Refresh
Affected Elements :
--> Selection Type : Region
--> Region : DEPT_2 --- Je Region a data insert hobe. Seta Refresh dite hobe