Working with Oracle 8i, I am trying to use the following nested decode from a where clause in the select statement to determine the claim's reason code. The following is from the where clause, can anyone assist me in telling me what I need to add or modify to use this in the select statement? Thanks
decode((select reason_code from hsd_hold_reason
where hsd_hold_reason.seq_claim_id = cv.hdr_seq_claim_id and rownum = 1),null,decode (cv.adjustment_reason,
null,
(decode(cv.not_covered_reason,
null,
(decode(cv.other_carrier_rsn,
null,
(decode(cv.allowed_reason,Null,cv.allowed_reason)),
cv.other_carrier_rsn)),
cv.not_covered_reason)),
cv.adjustment_reason),(select reason_code from hsd_hold_reason
where hsd_hold_reason.seq_claim_id = cv.hdr_seq_claim_id and rownum = 1)) = rcm1.reason_code(+)
decode((select reason_code from hsd_hold_reason
where hsd_hold_reason.seq_claim_id = cv.hdr_seq_claim_id and rownum = 1),null,decode (cv.adjustment_reason,
null,
(decode(cv.not_covered_reason,
null,
(decode(cv.other_carrier_rsn,
null,
(decode(cv.allowed_reason,Null,cv.allowed_reason)),
cv.other_carrier_rsn)),
cv.not_covered_reason)),
cv.adjustment_reason),(select reason_code from hsd_hold_reason
where hsd_hold_reason.seq_claim_id = cv.hdr_seq_claim_id and rownum = 1)) = rcm1.reason_code(+)