larf311 larf311 - 2 years ago 108
SQL Question

How do you strip leading spaces in Oracle?

I need to strip leading spaces from a column in Oracle. I've Googled but haven't found any answers except to write my own function which I'd like to avoid.

What's the easiest way to accomplish this?

Answer Source

You can user LTRIM Oracle function:

SQL> select ltrim(' hello world') from dual;

hello world

For ending spaces you can use RTRIM. And for more options check out TRIM.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download