Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: How to select column with one or more spaces
In article <3B4B9AB5_at_MailAndNews.com>, Andy says...
>
>Hi,
>
>I wonder if there is a way in a query to select column with one or more
>spaces. For the query below, it can only get rows with one space.
>
>select col_name from tab_name
> where col_name = ' ';
>
ops$tkyte_at_ORA8I.WORLD> create table t ( x varchar2(5) );
Table created.
ops$tkyte_at_ORA8I.WORLD>
ops$tkyte_at_ORA8I.WORLD> insert into t values ( ' ' );
1 row created.
ops$tkyte_at_ORA8I.WORLD> insert into t values ( ' ' );
1 row created.
ops$tkyte_at_ORA8I.WORLD> insert into t values ( ' ' );
1 row created.
ops$tkyte_at_ORA8I.WORLD> insert into t values ( ' ' );
1 row created.
ops$tkyte_at_ORA8I.WORLD> insert into t values ( ' ' );
1 row created.
ops$tkyte_at_ORA8I.WORLD> insert into t values ( 'hello' );
1 row created.
ops$tkyte_at_ORA8I.WORLD> insert into t values ( 'World' );
1 row created.
ops$tkyte_at_ORA8I.WORLD> insert into t values ( ' abc ' );
1 row created.
ops$tkyte_at_ORA8I.WORLD>
ops$tkyte_at_ORA8I.WORLD> select x, length(x)
2 from t
3 where rtrim(x) is null
4 and x is not null ;
X LENGTH(X)
----- ----------
1 2 3 4 5
ops$tkyte_at_ORA8I.WORLD>
>Thanks, Andy
>
>------------------------------------------------------------
> Get your FREE web-based e-mail and newsgroup access at:
> http://MailAndNews.com
>
> Create a new mailbox, or access your existing IMAP4 or
> POP3 mailbox from anywhere with just a web browser.
>------------------------------------------------------------
>
-- Thomas Kyte (tkyte@us.oracle.com) http://asktom.oracle.com/ Expert one on one Oracle, programming techniques and solutions for Oracle. http://www.amazon.com/exec/obidos/ASIN/1861004826/ Opinions are mine and do not necessarily reflect those of Oracle CorpReceived on Tue Jul 03 2001 - 19:08:05 CDT
![]() |
![]() |