Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: HELP! PL/SQL-LEADING ZERO

Re: HELP! PL/SQL-LEADING ZERO

From: Gerard Pex <gpex_at_xs4all.nl>
Date: Sat, 4 Nov 2000 10:33:11 +0100
Message-ID: <8u39gu$s6f$1@news1.xs4all.nl>

Another solution is to use the format mask '0999' (leading zeros),

e.g.

insert into test (runno) values (to_char(i, '0999'))

But the column in table test must be of the varchar2 type.

"Eric Givler" <egivler_at_flash.net> wrote in message news:nk3N5.5668$pq3.426243_at_news.flash.net...
> make runno varchar2(4)
> then insert into test (runno) values ( lpad(i,4,'0') )
>
> "Ho" <kowho_at_singnet.com.sg> wrote in message
> news:8u266p$bo2$1_at_coco.singnet.com.sg...
> > I need to create a table with 1000 records. I issue the INSERT command
> > within a loop.
> >
> > INSERT INTO TEST (RUNNO) VALUES(I)
> >
> > After running the SQL, the records are:
> >
> > 1
> > 2
> > 3.....
> >
> > What I want is :
> >
> > 0001
> > 0002
> > .
> > .
> > .
> > 0999
> > 1000
> >
> > How to achieve this ?
> >
> > Many thanks for your help in advance.
> >
> >
> >
>
>
Received on Sat Nov 04 2000 - 03:33:11 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US