Subject | Re: formatting a number |
---|---|
Author | Ali Gökçen |
Post date | 2005-04-27T07:58Z |
Hi Grant,
there may be an another ugly way if u don't want to use UDF.
i didn't try it but may works with some fix..
cast your number into tmp vachar(32) field.
add a special character to it tmp = tmp || '!'
do while substring(tmp from 30 for 1)<>'!'
tmp = '0' || tmp; -- put a ascii zero symbol right side
end
result = substring(tmp from 19 for 10); -- '0000012345'
Ali
P.S. TO engine devolopers: we want strlen built in function! ;)
--- In firebird-support@yahoogroups.com, Grant Brown <grant@s...>
wrote:
there may be an another ugly way if u don't want to use UDF.
i didn't try it but may works with some fix..
cast your number into tmp vachar(32) field.
add a special character to it tmp = tmp || '!'
do while substring(tmp from 30 for 1)<>'!'
tmp = '0' || tmp; -- put a ascii zero symbol right side
end
result = substring(tmp from 19 for 10); -- '0000012345'
Ali
P.S. TO engine devolopers: we want strlen built in function! ;)
--- In firebird-support@yahoogroups.com, Grant Brown <grant@s...>
wrote:
> Hi all,number of
>
> In FB1.5 how can I format a number into a string with a fixed
> leading zeros inside of a stored procedure ?a
>
> for example if the number is 10 then after formatting it would be
> string with a value of 0000010
>
> thanks in advance
>
> --
> Regards,
> Grant Brown
>
> Product Development Manager
> Phone : 02 4229 1185
> Mobile : 0412 926 995
> Email : grant@s...
> Web : www.sitedoc.com.au
>
> SiteDoc - Easy to Use - Powerful Results