|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
conditonal selection of 'AND' and 'SELECT'
I am working on Oracle reports . One of the parameters that a User
inputs is 'report_type'. Now, is there a way to do the following within a SQL query with no use of procedures or functions. select blaa from foo where something = something // if report_type='some_data' then and somethingelse = something else //else do nothing Also, IS there a way of doing something like the following // if report_type='some_data' then select blaa from foo where something = something // if report_type='some_data' then and somethingelse = something else //else do nothing else select blass1 from foo where something = something // if report_type='some_data' then and somethingelse = something else //else do nothing ALSO, how would one achieve the following select bla from ( if report_type=something then select decode(bla,..) else select decode(boo,..) .......... rest is the same for both the selects |
|
#2
|
||||
|
||||
|
1. see my answer on your second posting
2. Quote:
select decode(report_type, 'something', decode(bla...), decode(boo...)) from table... 3. Quote:
|
![]() |
| Viewing: Dev Articles Community Forums > Databases > General SQL Development > conditonal selection of 'AND' and 'SELECT' |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|