Checkbox in Interactive Report and Multiple Selective rows Update & Insert


 Step-1 : Create Interactive Report  (SQL Query)

select ID,
       APEX_ITEM.CHECKBOX(1,ID,'UNCHECKED') selected,                       BOOKING_ID,
       CONSIGNEE,
       AIRPORT_ORIGIN,
       AIRPORT_DESTI,
       COUNTRY_DESTI,
       DECODE (REGISTERED,1,'REGISTERED','Pending') REGISTERED_status,
       DECODE (BOOKED,1,'BOOKED','Pending') BOOKED_Status         

  From AIREXPORT_MST
  WHERE COM_ID=:GCOM_ID
  AND CREATE_BY=:GUSER_ID
  ORDER BY ID desc

*** Select Column "selected" 
--> Escape special characters : Off

Step-2 : Create Button

1. Button Name : DRAFT

Action : Submit Page


2. Button Name : BOOKED

Action : Submit Page


Step-2 : Create Tow  Process 

 1. Process Name : DRAFT
     Type : Excute Code 
     PL/SQL Code : 

begin

FOR i in 1..apex_application.g_f01.count 

LOOP

 if apex_application.g_f01(i) is not null then 

 

UPDATE    AIREXPORT_MST    SET 

REGISTERED_BY=:GUSER_ID,

REGISTERED_DATE=SYSDATE, 

REGISTERED=1

WHERE ID=apex_application.g_f01(i);

end if;

end loop;

commit;

end;

--> When Button Pressed : DRAFT


 2. Process Name : BOOKED
    Type : Excute Code 
    PL/SQL Code : 

begin

FOR i in 1..apex_application.g_f01.count 

LOOP

 if apex_application.g_f01(i) is not null then 

UPDATE   AIREXPORT_MST   SET 

BOOKED_BY=:GUSER_ID,

 BOOKED_DATE=SYSDATE,

 BOOKED=1

 WHERE ID=apex_application.g_f01(i);

end if;

end loop;

commit;

end;


--> When Button Pressed : BOOKED

========================================
========================================

Insert Table to anather Table by For Loop

========================================

DECLARE

V_SERIALNO   NUMBER;
V_REQ_COMP VARCHAR2(50);

BEGIN

FOR j IN 1 .. APEX_APPLICATION.G_F01.COUNT  LOOP

IF APEX_APPLICATION.G_F01 (j) IS NOT NULL  THEN

INSERT INTO   INSERT_TABLE_NAME

              (COLUMN_1, COLUMN_2, COLUMN_3, ........)          

 SELECT   COLUMN_1, COLUMN_2, COLUMN_3, ........   FROM TABLE_NAME
 WHERE ID IN apex_application.g_f01(j);        

Else raise_application_error(-20111,'You Must Select Check Box');

 END IF;
END LOOP;

 COMMIT;
END;

Post a Comment

Previous Post Next Post