I am using the following approach to tell if a record is the first record in the cursor for loop. Is there a better way to do this? Also, is there a way to see if the record is the last record?

for rec in (select tmp.*, rownum
from (select COLUMN_NAME
from user_tab_columns where table_name=upper('&1') ) tmp)
if rec.rownum = 1 then
end if;

end loop;