Gerlan 0 Newbie Poster

Hi,

I have created a parameter table, added 1 column to it and populated that column with 1 value as shown here:

CREATE TABLE tbl_param(
maxcount NUMBER);

INSERT INTO tbl_param
VALUES (5);

My problem is I want to create a loop from 1 to 5, but instead of just using 5 as my terminator I would like to read in the value from my table tbl_param with the value being 5 (from maxcount record).

I have tried the following:

FOR i in 1..maxcount
LOOP
i := i +1;
DBMS_OUTPUT.PUT_LINE('Count is: ' || i);
EXIT WHEN i > 5;
END LOOP;

Is it even possible to read in a value from a record as a max value for a loop?