rendered paste bodyBEGIN
select decode(p_buck_line_typ,
'DISPUTE_ONLY',decode(nvl(p_amt_in_disp,0),0,0,1),
'PENDADJ_ONLY',decode(nvl(p_amt_adj_pen,0),0,0,1),
'DISPUTE_PENDADJ',decode(nvl(p_amt_in_disp,0),
0,decode(nvl(p_amt_adj_pen,0),0,0,1),
1),
decode( greatest(p_days_from,
ceil(p_as_of-p_due_date)),
least(p_days_to,
ceil(p_as_of-p_due_date)),1,
0)
* decode(nvl(p_amt_in_disp,0), 0, 1,
decode(p_bucket_category,
'DISPUTE_ONLY', 0, 'DISPUTE_PENDADJ', 0,
1))
* decode(nvl(p_amt_adj_pen,0), 0, 1,
decode(p_bucket_category,
'PENDADJ_ONLY', 0, 'DISPUTE_PENDADJ', 0,
1)))
into bucket_amount
from dual;
return(bucket_amount);
END;