I need in one Oracle PL/SQL select to switch between raw select and hierarchical select statements depending on some variable. But, cannot use If statement in select. For example, I have hierarchical statement
select a.*
from myTable a
start with a.id = varValue
connect by prior a.id = a.parentId
if some varCondition is 0.
If varCondition = 1 then select should give result the same as result of statement
select a.* from myTable a where a.id = varValue
Something like select a.* from myTable a start with a.id = varValue connect by prior a.id = decode(varCondition, ...)
Is it possible?