There are two solutions:
- Formatting Prefix Fill Mode ('
FM '), which suppresses the optional blank character prefix for the to_char number in to_char . I believe this option is preferable because it is integrated with the to_char format and does not require an additional function call; LTRIM return value from to_char to_char .
The code below shows the results of both solutions:
Select concat('NTA', to_char(1,'FM0000000000000')), concat('NTA', ltrim(to_char(1,'0000000000000'))), concat('NTA', to_char(1,'0000000000000')) from dual;
"CONCAT('NTA',TO_CHAR(1,'FM0000000000000'))" : "NTA0000000000001" "CONCAT('NTA',LTRIM(TO_CHAR(1,'0000000000000')))" : "NTA0000000000001" "CONCAT('NTA',TO_CHAR(1,'0000000000000'))" : "NTA 0000000000001"
Paul kern
source share