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?
You can user LTRIM Oracle function:
SQL> select ltrim(' hello world') from dual;
LTRIM('HELLOWORLD')
-------------------
hello world
For ending spaces you can use RTRIM. And for more options check out TRIM.
use the trim function removes all specified characters either from the beginning or the ending of a string.
trim( [ leading | trailing | both [ trim_character ] ] string1 )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With