TRIM Leading letters then Leading 0

Database

TRIM Leading letters then Leading 0

I have a column that always has 12 characters.  The values can vary with how many leading letters and zeros they have.  

Example list:

A00294759323

HA2947037493

A29403829574

194093829593

D00284938293

000294869302

Desired output:

294759323

2947037493

29403829574

194093829593

284938293

294869302

Is there a way to TRIM LEADING '0' OR 'A' OR 'B' OR 'C' etc.?

2 REPLIES
Junior Contributor

Re: TRIM Leading letters then Leading 0

The easiest way to get what you want is probably a regular expression, find the first digit which is not a zero:

regexp_substr(col, '([1-9].*)')

Re: TRIM Leading letters then Leading 0

Perfect. Thank you!