SQL Language (MOSC)

MOSC Banner

Conditional Querying of one option among two options Within sql

edited Dec 21, 2013 12:28AM in SQL Language (MOSC) 4 commentsAnswered
 Dear collegues,
Is there any possibility to implement in one declarative sql select something like conditional query.
So that based on some condition one of two or many SQLs is executed and this is packaged on one SQL...but only one not both of them and 
then making restriction on return resultset - afraid of perfomances issues.


Something like this ( just illustrating the idea ...sql is not ok ):

Select X.c1, X.c2, X.c3
   from
    ( Case condition 
        when '1'
        Select A1 C1, A2 C2, A3 C3
          From T1
         Where ....;
       when '2'
        Select B1 C1, B2 C2, B3 C3

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center