Hi Folks,
I have a "From clause query" block type, which is based on query that uses a substitution variable (:BLOCK.COLUMN) from previous block. When I run a query, then I obtain an error: ORA-01008: not all variables bound.
My query looks like:
select seq_no, prod_code, descr, curr_code,
max(decode(sched_type_code,'ROLLOVER',amt,0)) OUTSTD_DRAW,
max(decode(sched_type_code,'INTCHG',amt,decode(sched_type_code,'FEEREC',amt,0))) OUTSTD_INTEREST_FEE
from
(
select r.fac_no, r.prod_code, f.descr, r.prod_seq_no seq_no, r.curr_code, r.sched_type_code,sum(nvl(rep_amt,0)) amt
from repay_scheds r,
fac_prods f
where r.fac_no = f.fac_no
and r.prod_code = f.prd_code
and r.prod_seq_no = f.seq_no
and r.fac_no = :B2.FAC_NO
and r.trans_ref_from is not null
and r.status <> 'P'
group by r.fac_no, r.prod_code, f.descr, r.prod_seq_no, r.curr_code, r.sched_type_code
)
group by seq_no, prod_code, descr, curr_code
having max(decode(sched_type_code,'ROLLOVER',amt,0)) >0 or max(decode(sched_type_code,'INTCHG',amt,decode(sched_type_code,'FEEREC',amt,0))) > 0
Once I replace that substitution variable in query condition with some exact test number then it works fine.
select seq_no, prod_code, descr, curr_code,
max(decode(sched_type_code,'ROLLOVER',amt,0)) OUTSTD_DRAW,
max(decode(sched_type_code,'INTCHG',amt,decode(sched_type_code,'FEEREC',amt,0))) OUTSTD_INTEREST_FEE
from
(
select r.fac_no, r.prod_code, f.descr, r.prod_seq_no seq_no, r.curr_code, r.sched_type_code,sum(nvl(rep_amt,0)) amt
from repay_scheds r,
fac_prods f
where r.fac_no = f.fac_no
and r.prod_code = f.prd_code
and r.prod_seq_no = f.seq_no
and r.fac_no = 2012500
and r.trans_ref_from is not null
and r.status <> 'P'
group by r.fac_no, r.prod_code, f.descr, r.prod_seq_no, r.curr_code, r.sched_type_code
)
group by seq_no, prod_code, descr, curr_code
having max(decode(sched_type_code,'ROLLOVER',amt,0)) >0 or max(decode(sched_type_code,'INTCHG',amt,decode(sched_type_code,'FEEREC',amt,0))) > 0
How can I use substitution variable within query for "From clause query" block type? Or any other way how to get the same result?
Thanks for your reply.
Tomas