Note, this a simplified version of what I am trying to resolve, but hopefully illustrates my question appropriately.
Any help is welcome!
Is it possible to use an "If, Then, Else" or "Decode" or "Case" statement in the where clause of a PL/SQL command?
Example:
Define &p1 = 'Y'
Define &p2 = '01/01/2001 00:00:00'
Define &p3 = '06/30/2001 23:59:00'
Select
*
From
Table
Where
-- Attempt #1
If &p1 = 'Y' Then Date_From_Table >= &p2 Else Date_From_Table > &p3 End If
-- Attempt #2
Case When &p1 = 'Y' Then Date_From_Table >= &p2 Else Date_From_Table > &p3 End
-- Attempt #3
Decode(&p1, 'Y', Date_From_Table >= &p2, Date_From_Table > &p3)