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: Obtain only alphabets from table

Re: Obtain only alphabets from table

From: Knut Stolze <stolze_at_de.ibm.com>
Date: Wed, 30 Jun 2004 10:41:13 +0200
Message-ID: <cbtub9$c7l$2@fsuj29.rz.uni-jena.de>


Reddy wrote:

> There is a table name "testtable". This table has three columns
> col1(char), col2(int) and col3(char). The data in the table will be as
> mentioned below:
>
> ------------------------------------------
> Col1 Col2 Col3
> 0 0 0
> 1 1 1
> 2 2 2
> 3 3 3
> 4 4 4
> 5 5 5
> 6 6 6
> 7 7 7
> 8 8 8
> 9 9 9
> a 10 A
> A 11 A
> b 12 B
> B 13 B
> c 14 C
> C 15 C
> ------------------------------------------
>
> How can i get only the alphabets and not numerics from Col3 with the
> order by caluse on Col2?
>
> The result should be as follows:
> A
> B
> C

Indeed, it has the distinctive smell of an exercise you are supposed to solve.

SELECT DISTINCT col3
FROM testtable
WHERE col3 NOT BETWEEN '0' AND '9'

or:

SELECT DISTINCT col3
FROM testtable
WHERE col3 BETWEEN 'A' AND 'Z' OR

       col3 BETWEEN 'a' AND 'z'

-- 
Knut Stolze
Information Integration
IBM Germany / University of Jena
Received on Wed Jun 30 2004 - 03:41:13 CDT

Original text of this message

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