Last active
February 8, 2023 19:23
-
-
Save jon-dixon/cc54ad39d4e922c44e74da7be04bdc17 to your computer and use it in GitHub Desktop.
Working with Lists APEX_STRING.PUSH
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE | |
CURSOR cr_tasks IS | |
SELECT task_id | |
, task_status | |
FROM cndemo_tasks; | |
lt_archived_task_ids apex_t_number; | |
BEGIN | |
-- Loop through all tasks. | |
FOR task_rec IN cr_tasks LOOP | |
IF task_rec.task_status = 'ARCHIVE' THEN | |
-- Do some processing. | |
-- Add the task ID to the array. | |
-- apex_string.push always appends the value to the array. | |
apex_string.push | |
(p_table => lt_archived_task_ids, | |
p_value => task_rec.task_id); | |
END IF; | |
END LOOP; | |
-- Show the Task IDs in the array using apex_string.join. | |
dbms_output.put_line('Array Contents: ' || apex_string.join(lt_archived_task_ids,':')); | |
-- Delete Task IDs that has a status of ARCHIVE | |
DELETE FROM cndemo_tasks | |
WHERE task_id MEMBER OF lt_archived_task_ids; | |
END; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment