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!

Loop with select count(*) and 2 Variables with values from that select

953175Mar 31 2017 — edited Apr 3 2017

Hi,

I´ve some Problem to code a Little Loop with "my Special Needs".

I´ve a Table where I made a selection

Select id, value from Table_loop;

Then I´d like to use this in my plsq like:

DECLARE

var_id NUMBER;

var value varchar2 (20);

var_max number;

var_Loop number := 1;

BEGIN

var_max := select Count(id) from Table_loop;

LOOP

IF var_loop > var_max THEN exit;

?? var_id := "the next id from Select id, value from Table_loop;"
?? var_value := the next value from Select id, value from Table_loop;"

...
...

do something with the next id and value..

END;
..
..

thx

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 1 2017
Added on Mar 31 2017
11 comments
2,418 views