Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

conditionally select from table

managed BEANOct 20 2017 — edited Oct 20 2017

Hello all oracle dba experts,

I am here in search for your lighting knowledge to help me.

I would like ( not sure if possible) to select a column from some table depending on the user input bind variable, like:

select  (case :bindvar = -1 then

  select columnA

  from tableA

  where columnB='something';

else

  select columnC

  from tableB

  where columnD = 'otherThing';

end;)

from dual;

Can you help me out with the correct syntax, please?

Thanks

Regards,

Carlos

This post has been answered by Cookiemonster76 on Oct 20 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 17 2017
Added on Oct 20 2017
5 comments
974 views