Update table with if statement PS/SQL
- by Matt
I am trying to do something like this but am having trouble putting it into oracle coding.
BEGIN
IF ((SELECT complete_date FROM task_table WHERE task_id = 1) IS NULL)
THEN
UPDATE task_table SET complete_date = //somedate WHERE task_id = 1;
ELSE
UPDATE task_table SET complete_date = NULL;
END IF;
END;
But this does not work i also tried
IF EXISTS(SELECT complete_date FROM task_table WHERE task_id = 1)
with no luck