Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Blog Handle IG Form and IG Regions - crud_apis
-------------------------------------------------------------------------------
PROCEDURE create_task
(pr_task_rec IN cndemo_tasks%ROWTYPE,
x_task_id OUT cndemo_tasks.task_id%TYPE) IS
l_task_number cndemo_tasks.task_number%TYPE;
BEGIN
-- Generate Task Number.
l_task_number := TRUNC(dbms_random.value(100000,999999));
INSERT INTO cndemo_tasks
(task_number, task_name, task_detail,
task_owner, due_date, task_status)
VALUES
(l_task_number, pr_task_rec.task_name, pr_task_rec.task_detail,
pr_task_rec.task_owner, pr_task_rec.due_date, 'NEW')
RETURNING task_id INTO x_task_id;
-- If INSERT succesfull, Add Call to Send Email here.
END create_task;
-------------------------------------------------------------------------------
PROCEDURE update_task
(pr_task_rec IN cndemo_tasks%ROWTYPE) IS
BEGIN
UPDATE cndemo_tasks
SET task_number = pr_task_rec.task_number
, task_name = pr_task_rec.task_name
, task_detail = pr_task_rec.task_detail
, task_owner = pr_task_rec.task_owner
, due_date = pr_task_rec.due_date
, task_status = pr_task_rec.task_status
WHERE task_id = pr_task_rec.task_id;
-- If UPDATE succesfull and task_owner was changed,
-- Add Call to Send Email here.
END update_task;
-------------------------------------------------------------------------------
PROCEDURE delete_task
(p_task_id cndemo_tasks.task_id%TYPE) IS
BEGIN
DELETE FROM cndemo_tasks
WHERE task_id = p_task_id;
END delete_task;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment