Subject | CORRECTION Re: [firebird-support] formatting a number |
---|---|
Author | Ali Gökçen |
Post date | 2005-04-27T15:04:54Z |
Hi,
I improved my solution a little more, whenever i find a spare
time.. :)
tmp = cast(12345 as varchar(10)) || 'I love Firebird even without
strlen! ;)';
while (not substring(tmp from 10 for 1) between '0' and '9')
tmp = '0' || tmp;
end
result = substring(tmp from 1 for 10); -- '0000012345'
nevertheless, the solution posted by Helen is more clear.
if you have too much records for this operation, like operator may
more slow i think..
Regars,
Ali
I improved my solution a little more, whenever i find a spare
time.. :)
tmp = cast(12345 as varchar(10)) || 'I love Firebird even without
strlen! ;)';
while (not substring(tmp from 10 for 1) between '0' and '9')
tmp = '0' || tmp;
end
result = substring(tmp from 1 for 10); -- '0000012345'
nevertheless, the solution posted by Helen is more clear.
if you have too much records for this operation, like operator may
more slow i think..
Regars,
Ali