Re: Need Help With SQL*Forms & Looping Within A Block
Date: 14 Jul 1993 05:38:17 -0500
Message-ID: <CA5HGL.7oM_at_uk.ac.brookes>
Roy Johnson (rjohnson_at_shell.com) wrote: [a loop to process all records]
But, the original question was to leave you in the starting block and record. This code will allow you to process all the records in any block, and then finish with the cursor back where it started, and the processed block in the same condition it started: it scrolls it back to its starting position.
All the movement routines should be checked to ensure that the cursor did move successfully.
DECLARE
curs_field CHAR(60) := :system.cursor_field;
top_rec_num number;
rec_num number;
BEGIN
GO_BLOCK(:process_block);
rec_num := :system.cursor_record;
top_rec_num := BLOCK_CHARACTERISTIC(:process_block, TOP_RECORD);
FIRST_RECORD;
LOOP
(insert your case specific code here)
EXIT WHEN :system.last_record = 'TRUE';
DOWN;
END LOOP;
WHILE :system.cursor_record != top_rec_num LOOP
UP;
END LOOP;
WHILE :system.cursor_record != rec_number LOOP
DOWN;
END LOOP;
GO_FIELD(curs_field);
END;
-- _________________________ ______________________________________ / Tommy Wareing \ / Whadda you mean it's all my fault? \ | p0070621_at_uk.ac.brookes X Deny everything, and if you can't: | \ 0865-483389 / \ Pass the Buck / ~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Received on Wed Jul 14 1993 - 12:38:17 CEST