Master-Details (Grid Process Save/Update/Delete)

 

Step-1 :

Create Normally Master-Details Page Design.


Step-2 :

Master from Data Save Default Processes.


Step-3 :

You Must be Grid Processes Type Change .

Type : Execute Code

Language : PL/SQL


DECLARE

    VREJCAUS   NUMBER;

BEGIN

    CASE :APEX$ROW_STATUS

        WHEN 'C'

        THEN

            SELECT NVL (MAX (EMPLOYEE_ID), 0) + 1

            INTO VREJCAUS

            FROM EMPLOYEES;


INSERT INTO EMPLOYEES (

            EMPLOYEE_ID,

            FIRST_NAME,

            LAST_NAME,

            EMAIL,

            PHONE_NUMBER,

            HIRE_DATE,

            JOB_ID,

            SALARY,

            COMMISSION_PCT,

            MANAGER_ID,

            DEPARTMENT_ID,

            STATUS)

VALUES (VREJCAUS,

       :FIRST_NAME,

       :LAST_NAME,

       :EMAIL,

       :PHONE_NUMBER,

       :HIRE_DATE,

       :JOB_ID,

       :SALARY,

       :COMMISSION_PCT,

       :MANAGER_ID,

       :P7_DEPARTMENT_ID,

       :STATUS)

RETURNING EMPLOYEE_ID

INTO :EMPLOYEE_ID;

WHEN 'U'

        THEN

 UPDATE 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,

        STATUS=:STATUS

 WHERE EMPLOYEE_ID = :EMPLOYEE_ID;

 WHEN 'D'

        THEN

            DELETE EMPLOYEES

             WHERE EMPLOYEE_ID = :EMPLOYEE_ID;

    END CASE;

END;

When Button Pressed : null

Post a Comment

Previous Post Next Post