Re: Need Help With SQL*Forms & Looping Within A Block
Date: 9 Jul 93 08:10:18 EDT
Message-ID: <7599.2c3d27ea_at_hayes.com>
In article <david.r.barstis-080793090146_at_no-name-medadmin.med.umich.edu>, david.r.barstis_at_med.umich.edu (David R. Barstis) writes:
> I need to know if it is possible and of course how it is possible, to loop
> through the records in a block and perform some operation on each, but
> leave you in the same block and record that you started in. For example,
> you make some
> query and retrieve some number of records for the block. Then, maybe a
> key-trigger or something that will loop through each record and copy a few
> fields to another table in the database or something. But it would leave
> the status of the FORM in the same status as when you started the trigger.
> I would assume that you could do a loop with go_records until some sort of
> error condition (notfound or something) and accomplish it, but do you know
> of any "for each record do" construct? Any help would be appreciated.
>
> Thanks,
> Dave Barstis
> E-mail: david.r.barstis_at_med.umich.edu
>
> "I'm so broke I can't even pay attention!"
Given that you have retrieved one or more records into the block and want to perform some type of a looping operation The 'guts' of a trigger or procedure to do it would look something like --
DECLARE
loop_control NUMBER := 1;
BEGIN
GO_RECORD('1'); WHILE loop_control = 1 LOOP (insert your case specific code here) IF :system.last_record = 'TRUE' THEN loop_control := 0; ELSE NEXT_RECORD; END IF; END LOOP;
END;
| Frank Greene DELPHI SYSTEMS Inc | _/_/_/ _/_/_/ | | Telephone [615] 458-6032 | _/_/ _/_/ | | Internet 74200.427_at_compuserve.com | _/_/ _/_/ _/_/_/ | | Compuserve 74200,427 | _/_/ _/_/ _/_/ | | 324 Ootsima Way | _/_/ _/_/ _/_/ | | Loudon, TN 37774 | _/_/_/ _/_/_/ _/_/_/ | ---------------------------------------------------------------------------- | Of course, any opinions or suggestions are strictly my own | ----------------------------------------------------------------------------Received on Fri Jul 09 1993 - 14:10:18 CEST