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!

how to use decode on the value part ?

551174Feb 14 2008 — edited Feb 14 2008
i have a query

select
col1, col2, col3
from
tab1, tab2
where
cond1= 'parameter1'

I need to modify this query to use a decode function instead of this parameter1.
something like

select
col1, col2, col3
from
tab1, tab2
where
cond1= decode(parameter1, 'x','val1','val2')

How can i use such a decode function on the value part ?
IF i try this, it gives me no data found error....

The following is also not working..IS there a way to do such cases ?
select
col1, col2, col3
from
tab1, tab2
where
cond1= ( select decode(parameter1, 'x','val1','val2') from dual )
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 13 2008
Added on Feb 14 2008
5 comments
376 views