This discussion is archived
5 Replies Latest reply: Apr 18, 2013 7:35 AM by Andreas Weiden RSS

Looping through records that havent been added yet

789736 Explorer
Currently Being Moderated
Hi guys,

I was wondering if you could help me out. I need to loop through some records to count a specific flag. I have doen this before on a block which has been queried back from the database using the code below. However, under this scenario it has not been added to the database. The records have not been inserted yet, hence im not sure how to get the blk_cnt variable I have used in the example below. Could anyone help me out? perhaps I need a whole different approach?

Thanks.

n_tot_rec NUMBER := 0;
n_blk_cnt NUMBER := Get_Block_Property('BLK,QUERY_HITS);
n_added_count number := 0;

GO_BLOCK('BLK);
First_Record;

WHILE n_tot_rec < n_blk_cnt LOOP
if name_in('blk.added') = 'Y' then
n_added_count = n_added_count + 1;
end if;

if name_in('SYSTEM.LAST_RECORD') = 'FALSE' then
Next_Record;
end if;

n_tot_rec := n_tot_rec +1;

END LOOP;

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points