Reputation: 3
I have a field that is 11 in length, what happens in this field is that when the entered data does not reach 11, we must fill the rest with 0, for example we enter the data "CARLOS", then in the database it should look like this "00000CARLOS"
Upvotes: 0
Views: 354
Reputation: 222482
You can use lpad()
:
lpad(mycol, 11, '0')
This function is supported in both MySQL and Oracle (you initially tagged both), with the same syntax.
Upvotes: 1