The solution doesnot give correct output, and can be done in easy way
Khushi, January 22, 2017 - 6:11 am UTC
The solution which AskTom Team provided doesnot give correct output, and can be done in more easy way.
The q is asked to get output 1111 but by your coding, its coming 11111 and moreover it can be done in much more easier way. as per my understanding, please find below my solution-
declare
lowerl number:= 1;
upperl number:= 4;
num varchar2(10);
begin
for i in lowerl..upperl
loop
num:=num||to_char(lowerl);
--No need of this now if i=3 then upperl:=5;
--end if;
end loop;
message(num);
end;
Thanks,
Please let me know if I am wrong.
January 23, 2017 - 12:56 am UTC
At AskTom, we're trying to just go "here's something you can just cut/paste" but explaining the 'why'.
We're interpreting the question as "how do I alter the upper limit" of a loop construct whilst in the loop, as opposed to "how do I get a series of consecutive 1's"
Rajendra Kalepu, January 22, 2017 - 6:24 am UTC
Thank you very much Tom.
Rajendra Kalepu, January 22, 2017 - 6:24 am UTC
Thank you very much Tom.