curCD SYS_REFCURSOR;
TYPE tCurCDRecType IS TABLE OF tCurCDRec index by PLS_integer;
recCD tCurCDRec;
TYPE tblclaimdetmonthtype IS TABLE OF tblclaimdetmonthly_s_part%ROWTYPE;
tblclaimonthly tblclaimdetmonthtype := tblclaimdetmonthtype ();
IF v_table = 'C' THEN
OPEN curCD
FOR
' SELECT /*+RULE CD.CLAIMID,CD.CLAIMLINENUMB,0 CLAIMDETAILHISTSEQNUMB,''A'' CLAIMDETAILHISTRECTYPECD,'||
' CD.PATIENTNUMBER,CD.INTAKEID,CD.OPERATIONCENTERCODE,CD.SERVICECODE,CD.UOMCODE,CD.PROVID,'||
' CD.FROMDATE,CD.TODATE,CD.PROVINVAMOUNT,CD.APNUMB,CD.APPROVEDUNITS,CD.PROVAMOUNT,CD.PLANAMOUNT,CD.FEEFORSERVICE,'||
' CD.STATUSCD,CD.PLANSVCSCHEDULERATE,CD.PROVSVCSCHEDULERATE,CD.AUTHORIZATIONID,CD.EXTRACONTRACTREASONCODE,'||
' CD.PLANOVERRIDERATE,CD.PROVOVERRIDERATE,CD.CLAIMDETADJTYPECD,CD.ACCOUNTINGDEPARTMENTRPTCD,CD.PROVTYPECD,'||
' CD.CARRIERSERVICECODE,CD.ARNumb,C.PROVINVNUMB,C.PROVINVDT,C.BRANCHNUMB, CD.FincTypeRevCd '||
'FROM akdadhan.tblClaimDetail_new CD, tblClaim C '||
'WHERE (AuthorizationID IS NOT NULL OR ProvAmount > 0) '||
'AND APNumb IS NOT NULL '||
'AND CD.ClaimID = C.ClaimiD '||
'AND CD.ClaimID >= ' || v_FirstCD ||
'AND CD.ClaimID < ' ||v_MaxCD ||
'AND CD.Statuscd <>'||'''IGNORE''' ;
ELSE
OPEN curCD FOR
' SELECT CD.CLAIMID ,CD.CLAIMLINENUMB,CD.CLAIMDETAILHISTSEQNUMB,CD.CLAIMDETAILHISTRECTYPECD,'||
' CD.PATIENTNUMBER,CD.INTAKEID,CD.OPERATIONCENTERCODE,CD.SERVICECODE,CD.UOMCODE,CD.PROVID, '||
' CD.FROMDATE,CD.TODATE,CD.PROVINVAMOUNT,CD.APNUMB,CD.APPROVEDUNITS,CD.PROVAMOUNT,CD.PLANAMOUNT,CD.FEEFORSERVICE,'||
' CD.STATUSCD,CD.PLANSVCSCHEDULERATE,CD.PROVSVCSCHEDULERATE,CD.AUTHORIZATIONID,CD.EXTRACONTRACTREASONCODE,'||
' CD.PLANOVERRIDERATE,CD.PROVOVERRIDERATE,CD.CLAIMDETADJTYPECD,CD.ACCOUNTINGDEPARTMENTRPTCD,CD.PROVTYPECD, '||
' CD.CARRIERSERVICECODE,CD.ARNumb,C.PROVINVNUMB,C.PROVINVDT,C.BRANCHNUMB, CD.FincTypeRevCd '||
' FROM tblClaimDetail_H CD, tblClaim C '||
' WHERE (AuthorizationID IS NOT NULL OR ProvAmount <> 0) '|| -- 6/9/2006 - RRARMSTR - Check for all non-zero amounts
' AND APNumb IS NOT NULL '||
' AND (ClaimDetailHistRecTypeCD = ''E'' or ClaimDetailHistRecTypeCD = ''O'') '||
' AND CD.ClaimID = C.ClaimID '||
' AND CD.ClaimID >= ' ||v_FirstCD ||
' AND CD.ClaimID < ' || v_MaxCD ||
' AND CD.StatusCD <>'||'''IGNORE''' ;
END IF;
TimingStop(v_CurFiscalMonth, v_CurStep, v_Timings);
TimingStart('BEGIN INNER DETAIL LOOP (' || v_FirstCD || ' - ' || v_MaxCD || ')',v_Timings);
LOOP
FETCH curCD
BULK COLLECT INTO recCD LIMIT 100000;
-----------------------------------
PLS-00497: cannot mix between single row and multi-row (BULK) in INTO list