Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Nested While Loop

863440May 20 2011 — edited May 20 2011
Anyone have any ideas as to why this nested while loop is only executing the inner loop (100 times) and not the outer loop (10 times)?

DECLARE
V_NUMCOUNT NUMBER := 1;
V_TIMEVAL TIMESTAMP(6) := current_timestamp;
V_DEVICE NUMBER := 1;
BEGIN
WHILE (V_DEVICE < 11)
LOOP
WHILE (V_NUMCOUNT < 101)
LOOP
V_TIMEVAL := current_timestamp - (dbms_random.value(0, 2));
INSERT INTO MJ_RYANTR69 (MS_DEVICEID, MS_SAMPLENUM, MS_TSTAMP, DOWNSTREAMATTENUATION, DOWNSTREAMCURRRATE, DOWNSTREAMNOISEMARGIN, DOWNSTREAMPOWER,
UPSTREAMCURRRATE, UPSTREAMNOISEMARGIN, UPSTREAMPOWER) VALUES (V_DEVICE, V_NUMCOUNT, V_TIMEVAL, ceil(dbms_random.value(1, 100)),
ceil(dbms_random.value(2000, 5000)),
ceil(dbms_random.value(20, 60)), ceil(dbms_random.value(100, 200)), 1024, ceil(dbms_random.value(1, 50)), ceil(dbms_random.value(1, 50)));
V_NUMCOUNT := (V_NUMCOUNT + 1);
END LOOP;
V_DEVICE := (V_DEVICE + 1);
END LOOP;
commit;
END;
/
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 17 2011
Added on May 20 2011
3 comments
226 views