Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Update Oracle table to remove whitespace using trim function

Re: Update Oracle table to remove whitespace using trim function

From: Martin T. <bilbothebagginsbab5_at_freenet.de>
Date: 1 Aug 2006 15:14:19 -0700
Message-ID: <1154470459.067348.140890@b28g2000cwb.googlegroups.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US