Header Ads

Header ADS

Manually Data Insert, Update, Delete On Oracle Apex Interactive Grid

How to Manually Insert, Update, and Delete On Oracle Apex Interactive Grid

Topic Introduction: In this tutorial, we will learn how to manually insert, update, and delete data from Interactive Grid in Oracle Apex. To complete the manual write process for inserting, editing, and deleting data we need to change the automated created process.






1. Go to the automated created process to insert, update, and delete data.
2. Go to Process Properties Setting ==> Target Type: PL/SQL Code.
3. Write your PL/SQL code on PL/SQL Code to Insert/Update/Delete Box according to the below structure.

Example:

DECLARE
A NUMBER;
begin  
   case :APEX$ROW_STATUS  
     when 'C' then  
         SELECT NVL(MAX(EMPLOYEE_ID),0)+1 INTO A FROM OEHR_EMPLOYEES;
         insert into OEHR_EMPLOYEES(EMPLOYEE_ID,FIRST_NAME,LAST_NAME,EMAIL,PHONE_NUMBER,HIRE_DATE,JOB_ID,SALARY,COMMISSION_PCT,MANAGER_ID,DEPARTMENT_ID)
 
         values (A,:FIRST_NAME,:LAST_NAME,:EMAIL,:PHONE_NUMBER,:HIRE_DATE,:JOB_ID,:SALARY,:COMMISSION_PCT,:MANAGER_ID,:DEPARTMENT_ID);
 
     when 'U' then  
         update OEHR_EMPLOYEES 
            set FIRST_NAME= :FIRST_NAME,
LAST_NAME= :LAST_NAME,
EMAIL= :EMAIL,
PHONE_NUMBER= :PHONE_NUMBER,
HIRE_DATE= :HIRE_DATE,
JOB_ID= :JOB_ID,
SALARY= :SALARY,
COMMISSION_PCT= :COMMISSION_PCT,
                MANAGER_ID=:MANAGER_ID,
DEPARTMENT_ID= :DEPARTMENT_ID
          where EMPLOYEE_ID  = :EMPLOYEE_ID;  
     when 'D' then  
         delete OEHR_EMPLOYEES
         where EMPLOYEE_ID = :EMPLOYEE_ID;
     end case; 

end;  








1 comment:

Theme images by Deejpilot. Powered by Blogger.