I have a sql query, say of the following form:
select a, b, c from table t where t.a = "hello" and t.b = "there" and t.c = "world" group by a,b,c
I would like to have a Boolean condition (d == true) to determine the computation above such that when say d is set to true, the above query get executed, and when d is false, the query gets reduced to the following and compiled:
select a, b from table t where t.a = "hello" and t.b = "there" group by a,b.
Any suggestions as to how this could be achieved using oracle 11g (sql/pl-sql/t-sql)?
What I have tried:
I have tried a simple logic of setting the flag and executing the query but I need to conditionally compile part of the query based on a preset condition.