Is it possible to update a column of a table from two optional tables, in Oracle. I mean, there are 2 tables whose columns are exactly same and, according to input Id, I want to update related table.
For eg.
UPDATE CASE WHEN EXISTS (
SELECT A.ID FROM Table_A A
WHERE A.ID = 'B1'
)
THEN
Table_A A
SET A.Status = '0'
WHERE A.ID = 'B1'
ELSE
Table_B B
SET B.Status = '0'
WHERE B.ID = 'B1'
Where Table_A and Table_B has exactly same columns with different records.
Thank you.
BEGIN
UPDATE Table_A A SET STATUS = ‘0’ WHERE A.ID = #ID#;
if sql%notfound then
UPDATE Table_B B SET STATUS = ‘0’ WHERE B.ID = #ID#;
END IF;
END;