Reputation: 467
I Wanted to convert 00017 to hex using oracle with leading zero's:
For Example:
**SELECT TO_CHAR(00017,'XXXX') FROM DUAL;**
Current Output of above query 11
But Expected output is with leading zero 00011.
Upvotes: 2
Views: 2806
Reputation: 17382
For padding zeros you have to add them to the pattern
select to_char(17, '0000X') from dual
In 000X
the X
is the format specifier and the number of 0
determine the length.
Upvotes: 3