Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Update Oracle table to remove whitespace using trim function
G Quesnel wrote:
> (...)
>
> You could even only update rows that require triming, with something
> like...
> update mytable
> set colx = trim(colx)
> where length(colx) > length(trim(colx));
>
Wouldn't this fail for VARCHAR2 columns that contain only spaces.
(Assuming we want to trim these.)
The empty VARCHAR2 string IS NULL so length would return NULL and the
entry would not be trimmed.
(...) where length(colx) > NVL(length(trim(colx)),0); should work
though.
best,
Martin
Received on Tue Aug 01 2006 - 17:14:19 CDT
![]() |
![]() |