Database Administration (MOSC)

MOSC Banner

for i in &1..&2 error out

edited Oct 9, 2023 5:15AM in Database Administration (MOSC) 2 commentsAnswered ✓

Hi all,

Please shed some light on how to get variables in the for for loop range.

1. if range are constants : for i in 1..2 , then no errors. <<---- OK

begin

for i in 1..2 loop

null;

end loop;

end;

/


2. However if for i in &1..&2 then error out <<<--------- ERROR


set define on <<--- if I put define on or without define on, still got the error.

begin

for i in &1..&2 loop

null;

end loop;

end;

Error report -

ORA-06550: line 2, column 14:

PLS-00103: Encountered the symbol "LOOP" when expecting one of the following:


* & - + / at mod remainder rem .. <an exponent (**)> ||

multiset

06550. 00000 - "line %s, column %s:\n%s"

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center