Link to home
Start Free TrialLog in
Avatar of Rassac
RassacFlag for Malta

asked on

Space inserted when Incrementing a number

Hi I am trying to update a field which has  a fomat of '00000'.

When I update using this code:

a.version      = TO_CHAR( a.version + 1, '00000')

I am getting for instance ' 00001'. Please note the space before the zeros.

Any help please?
Thanks.
Avatar of Rassac
Rassac
Flag of Malta image

ASKER

I managed to solve the problem by using Trim

a.version      = Trim(TO_CHAR( a.version + 1, '00000'))

Is there any explanation for this, why is a space being inserted?

Thanks.
- check the actual value of a.version what is its exact length or data type?
Avatar of Rassac

ASKER

It's varchar2(10)
ASKER CERTIFIED SOLUTION
Avatar of carlsiy
carlsiy
Flag of Philippines image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Rassac

ASKER

So how would you go around it? Is it necessary to use the trim or maybe some other code could be used?

thanks.
the code you used just about sums it up.