FOR rec IN (SELECT t.*
FROM tableCustomers t
WHERE t.CustomerNo = p_Cust
AND t.NameNo = p_EkNo
AND t.Type = 1
)
LOOP
-- Here I need to know how to find out,
-- the first read, the next read and the last read ?
END LOOP;
答案 0 :(得分:3)
FOR rec IN (SELECT t.*,
rownum as rn,
count(*) over () as cnt
FROM tableCustomers t
WHERE t.CustomerNo = p_Cust
AND t.NameNo = p_EkNo
AND t.Type = 1
)
LOOP
if rec.rn==1 then
dbms_output.put_line('first line!');
end if;
if rec.rn > 1 then
dbms_output.put_line('after first line!');
end if;
if rec.rn = cnt then
dbms_output.put_line('lastline!');
end if;
END LOOP;