Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CASE STATEMENT WHERE CLAUSE ISSUE

Status
Not open for further replies.
Feb 11, 2011
6
IN
Hi All ,

I want to write a case statement in where clause such that if

Value is TAG1 then in where clause it will search for TAG2 and TAG3.
Value is TAG2 then in where clause it will search for TAG1 and TAG3.
Value is TAG3 then in where clause it will search for TAG2 and TAG1.

if (v_temp_counter = v_tag_id_1 or v_temp_counter = v_tag_id_2 or v_temp_counter = v_tag_id_3)
then
select v_agg_data(rmu_id,NULL,NULL,risk_seq_no,risk_scenario_id)
bulk collect into v_risk_with_2_3
from erm_rpr_risk_dtls_t
where rmu_id=v_rmu_without_both_tags(v_cntr).rmu_id
and tag_id in
case when v_temp_counter = v_tag_id_1 then (v_tag_id_2,v_tag_id_3)
when v_temp_counter = v_tag_id_2 then (v_tag_id_1,v_tag_id_3)
when v_temp_counter = v_tag_id_3 then (v_tag_id_1,v_tag_id_2)
end;
end if;
 
Since that's oracle-specific, I suggest you post in the oracle forum relevant to your version, you'll probably get more answers.

Regards

T
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top