0
Answer

Looping only Once

Ramco Ramco

Ramco Ramco

13h
67
1

Hi

  I have below query . In C1 there are more than 1 record but below Cursor is showing only 1 record

Declare CURSOR C1 FOR Select T0."CardCode",T0."CardName",T0."U_AREA",T0."U_ROUTE",
	T0."U_Rider_1",T0."U_Rider_2",T0."U_Rider_3",T0."U_Rider_4"
	from OCRD T0
	inner join OCRG T1 on T0."GroupCode" = T1."GroupCode"
;
		
	for cur_row as C1 Do
	    SELECT cur_row."CardCode",cur_row."CardName",cur_row."U_AREA",cur_row."U_ROUTE",
	    T2."DocDate",T2."DocNum",
		(Select Sum("LineTotal") from INV1 where "DocEntry" = T2."DocEntry") As "Inv Total" ,'' As "Rider",
		'0' As "Exp Total"
		FROM OCRD T0
		left join OINV T2 on T2."CardCode" = T0."CardCode"
		where T2."DocDate" >= (:FromDate) and T2."DocDate" <= (:ToDate)
		and T0."CardCode" = cur_row."CardCode"
end for;

Thanks