Re: PL/SQL functions
Date: Thu, 24 Aug 2000 05:34:57 GMT
Message-ID: <5u2p5.10685$Yl4.244214_at_news.tpnet.pl>
Sandy,
You have to use lpad function.
SELECT lpad('255', 10, '0') FROM dual
0000000255
See below (taken from Oracle SQL manual).
LPAD(char1,n [,char2])
Returns char1, left-padded to length n with the sequence of characters in
char2; char2 defaults to a single blank. If char1 is longer than n, this
function returns the portion of char1 that fits in n.
Regards,
Zbigniew Sliwa
Oracle Programmer
Poland
email: zibi_at_at_yahoo.com
Sandy napisa³(a) w wiadomo¶ci:
<1bb019c5.139b05c7_at_usw-ex0110-076.remarq.com>...
>Hi,
>
>I would like to know if there is any function that :
>- for a number to add as many 0 (zeros ) than it will reach
>the maximum size of the variable which will contain it.
>
>for example : there is a variable DOLLAR in number(10) and
>in this variable i put 225 so i would like it to be
>0000000225.
>
>- in the same way i would like to put spaces variables in
>varchar types.
>
>
>So it would be a function that would have in input : the
>character i want to put (space or zero), the max size, and
>my variable.
>
>Or maybe it would be a function which would act in the one
>or the other way if it 's a number or a varchar variable.
>
>I hope it is clear
>THanks
>
>Sandy
>
>
>
>* Sent from AltaVista http://www.altavista.com Where you can also find
related Web Pages, Images, Audios, Videos, News, and Shopping. Smart is
Beautiful
Received on Thu Aug 24 2000 - 07:34:57 CEST