Help with lpad and trim ??
PJS5Aug 8 2007 — edited Aug 9 2007Hi, I am using the call below to add leading zeros in a select statement and it works fine.
LPAD (TRIM (ta.commission), 3, '0') "phase_code"
i.e. our phase_codes are generally 1,2,3,4, etc but need to be extracted for another purpose as 001, 002, 003, 004 etc.
The problem is i have now discovered that we will also have phase_codes that are typically 106001, 107001, 108001 etc.
So I need to do something like;
If the number selected = 1,2,3,4, etc add zeros in the extract to make it 001, 002, 003, 004 etc like currently happens but If the number = 106001, 107001, 108001 extract it as is.
Any thoughts??
Cheers, Peter