PHIL Sawyer
asked on
parameter - cond
Hi
Is it possible to have a conditional parameter on a query
eg
--:p_para1 -- enter either 1 or 2
--:p_product
--:p_company
select
t1.*
from mytable t1
where
(if :p_para1 = 1 then t1.product = :p_product
else
t1.company = :p_company)
Regards
Is it possible to have a conditional parameter on a query
eg
--:p_para1 -- enter either 1 or 2
--:p_product
--:p_company
select
t1.*
from mytable t1
where
(if :p_para1 = 1 then t1.product = :p_product
else
t1.company = :p_company)
Regards
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks
hmm, I was maybe a little too late.
Are you sure the accepted answer does what you wan it to?
Are you sure the accepted answer does what you wan it to?
philipsivyer,
for example - let's say you have row of data like this...
PRODUCT= your_product
COMPANY = your_company
Then I pass in the following parameters:
p_para1 = 1
p_product = my_product
p_company = your_company
I assume you would want to exclude that row. The answer you accepted does NOT, it would return that row which doesn't seem correct
for example - let's say you have row of data like this...
PRODUCT= your_product
COMPANY = your_company
Then I pass in the following parameters:
p_para1 = 1
p_product = my_product
p_company = your_company
I assume you would want to exclude that row. The answer you accepted does NOT, it would return that row which doesn't seem correct
Open in new window
alternately, but this second version is likely to be less useful with indexes
Open in new window