troubleshooting Question

Oracle Select in Case sentence

Avatar of Vinum
VinumFlag for Denmark asked on
Oracle Database
10 Comments1 Solution767 ViewsLast Modified:
I am no expert in Oracle / SQL....

In PL/SQL I want to execute a Select dependent of a variable.

I know, this example is not okay, but it illustrates what I mean:

case when &param = 1 then (select a,b,c from table)
         when &param = 2 then (select d,e,f from table)
         else (select g,h,i from table)

That is, when I run the sql, it prompts me for a parameter and dependend of the entered value, different values are selected from the table

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 10 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros