我有以下pl sql proc,我正在尝试在CUR上加入表
FETCH CUR INTO V_CTR_ID,V_TRXN_INTRL_REF_ID,V_TRXN_DT,V_ACCT_INTRL_ID,V_TRXN_BASE_AM;
EXIT WHEN CUR%NOTFOUND;
--dbms_output.put_line('Enter CUR');
OPEN CUR1 FOR SELECT distinct CTR.OCCUPATION,CTR.TAX_ID
FROM
BR_CTR_TRANS BR join CUR on
CUR.V_TRXN_INTRL_REF_ID=BR.TRANS_REF_ID AND CUR.V_ACCT_INTRL_ID=BR.ACCT_IDENTIFIER AND CUR.V_TRXN_BASE_AM=BR.TRANS_AMT_BASE AND CUR.V_TRXN_DT=BR.TRANS_DT
join CTR_XML_BR_COND CTR
on
BR.BR_CTR_SUM_REF_ID=CTR.CTR_ID;
我得到的错误是,CUR被视为表,并且给出的表或视图不存在。有人可以帮忙吗?
答案 0 :(得分:0)
您不能将JOIN连接到游标,但是可以在后续的SQL语句中使用使用获取的值。在这种情况下,请删除“ join cur”,然后将on子句条件移至“ where”子句。
fetch cur into v_ctr_id,v_trxn_intrl_ref_id,v_trxn_dt,v_acct_intrl_id,v_trxn_base_am;
exit when cur%notfound;
--dbms_output.put_line('Enter CUR');
open cur1 for select distinct ctr.occupation,ctr.tax_id
from br_ctr_trans br
join ctr_xml_br_cond ctr onbr.br_ctr_sum_ref_id=ctr.ctr_id
where 1=1
and cur.v_trxn_intrl_ref_id=br.trans_ref_id
and cur.v_acct_intrl_id=br.acct_identifier
and cur.v_trxn_base_am=br.trans_amt_base
and cur.v_trxn_dt=br.trans_dt;