I want to create a simple IF THEN ELSE PL SQL without creating an annonymous block like below for use in SQL TOOLS:
variable a varchar2(20)
variable b varchar2(20)
EXEC :a := '&insert_value_a'
EXEC :b := '&insert_value_b'
--this next part I don't know how to do:
IF value :a is given and it's not NULL THEN
EXECUTE
SELECT column1,column2,column3
FROM table
WHERE condition
AND column2 = :a or column3 = :a;
ELSE
-- if value b is given use it to get value :a
EXECUTE
SELECT column2 INTO :a
FROM table
WHERE column_x = :b;
SELECT column1,column2,column3
FROM table
WHERE condition
AND column2 = :a or column3 = :a;
END;