# SQL - Search for records containing special characters



## paul_carron (Oct 15, 2006)

Hi

Can I do a select statement on an Oracle database where I search a table for all records where field x contains special characters(ie it contains chanracters that are not between A to Z(both cases) and 0 to 9? These characters can be in the field also though.

I hope that makes sense.

Paul


----------



## midders (Jan 1, 1970)

This would be very tricky using just SQL; I'd recommend that you write a small program based on a "select fieldX from tableY" cursor and then check each letter of fieldX in turn to see if it is special.

If oracle sql supports a substring type function in the where clause then you could possibly check for a limited number of characters using something along the lines of:

```
select
   fieldX
from
   tableY
where
   instr('$',fieldX) = TRUE OR
   instr('&',fieldX) = TRUE OR
   instr('#',fieldX) = TRUE...
```
but it would be slow and clunky.

Slainte

midders


----------

