Below is the SP I have created.
`SET SERVEROUTPUT ON;
CREATE OR REPLACE PROCEDURE UPDATE_EMPLOYEE_STATUS IS
TYPE employee_info_rec IS RECORD(
id employee.id%type,
name employee.name%type
);
TYPE employee_info_table IS TABLE OF employee_info_rec INDEX BY PLS_INTEGER;
employee_info_data employee_info_table;
CURSOR emp_details is
SELECT AA.id, AA.name from employee AA;
l_limit PLS_INTEGER := 10000;
i PLS_INTEGER := 0;
BEGIN
OPEN emp_details;
LOOP
FETCH emp_details BULK COLLECT INTO employee_info_data LIMIT l_limit;
EXIT WHEN employee_info_data.COUNT = 0;
BEGIN
FORALL i IN 1 .. employee_info_data.COUNT
UPDATE employee
SET emp_status = 1
WHERE id = employee_info_data(i).establishment_org;
DBMS_OUTPUT.PUT_LINE('Processed id: ' || employee_info_data(i).id || ', name: ' || employee_info_data(i).name);
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Error occurred during update: ' || SQLERRM);
ROLLBACK;
END;
END LOOP;
COMMIT;
CLOSE emp_details;
END UPDATE_EMPLOYEE_STATUS;
/
execute UPDATE_EMPLOYEE_STATUS;`
I have the related data in table but I am getting Below Error
`Error occurred during update: ORA-01403: no data found
Records should be updated with print statement like
Processed id: 1, Name: Manoj
….`