Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Counter in For loops
Certain languages do have this capability, PL/SQL is not one of them. But it can be emulated (depending on how you wish to use it) using nested loops and ascii values, as follows:
declare
i1 number;
i2 number;
begin
for i1 in 65..90 Loop
for i2 in 65..90 loop dbms_output.put_line(chr(i1)||chr(i2)); end loop;
This for example will display 'AA', 'AB', 'AC', all the way through to 'ZZ'.
Hope this helps,
Dean Belshaw
"Sergey Khochay" <skhochay_at_pacbell.net> wrote in message
news:QkWH4.808$Sz2.371466_at_news.pacbell.net...
> ... That is the real "User's" question.
>
>
> "Greg Tada" <gtada_at_hotmail.com> wrote in message
> news:8clfc2$dnb$1_at_nnrp1.deja.com...
> > Is it possible to use a character string instead of a number as the
> > counter in a FOR loop? For example, I need a for loop that goes
> > from '00' to 'ZZ'.
> >
> > Thanks in advance,
> > Greg Tada
> >
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
> >
>
>
Received on Mon Apr 10 2000 - 00:00:00 CDT