Home » Developer & Programmer » Forms » doubt in loop
doubt in loop [message #83266] Sun, 31 August 2003 01:30 Go to next message
moon
Messages: 7
Registered: July 2002
Junior Member
I want to insert 20 records with the value incremented by one.

Declare
i varchar2(8) := '00000002';
a varchar2(8);
Begin
for j in 1..19 loop
i := i + 1;
message(i);pause;
End loop;
End;

In the above code i am getting the incremented value but i am getting only the numbers. But i am in need of with zeros concated..as the item is a varchar2 and not a number field..can any one suggest me..

for ex i am getting 3 instead of '00000003'.
Re: doubt in loop [message #83267 is a reply to message #83266] Sun, 31 August 2003 22:36 Go to previous messageGo to next message
Shailender Mehta
Messages: 49
Registered: June 2003
Member
Use LPAD function to pad the data with leading zeros.

select lpad('3', 8, '0')
from dual;

LPAD('3'
--------
00000003
Re: doubt in loop [message #83270 is a reply to message #83267] Tue, 02 September 2003 00:24 Go to previous message
moon
Messages: 7
Registered: July 2002
Junior Member
Thanks. but i thought when it goes in loop it will not give.. but i checked it it has given.
Previous Topic: Changing properties of Radio Button at runtime
Next Topic: set_item_property
Goto Forum:
  


Current Time: Thu Mar 28 15:31:34 CDT 2024