Skip to Main Content

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, JimmyG.

Asked: June 12, 2008 - 1:03 pm UTC

Last updated: June 12, 2008 - 3:04 pm UTC

Version: 9.2.0

Viewed 1000+ times

You Asked

Hello Tom!

I'm an SQL "business user" building a simple data quality report...
I want to check whether last names contain "non-allowable" characters

CASE WHEN crm2check.NAME2 is null THEN null WHEN LENGTH(TRIM(TRANSLATE(UPPER(crm2check.NAME2), ' -ABCDEFGHIJKILMNOPQRSTUVWXYZ', ' '))) is not null THEN 0 ELSE 1 END as DQ_NAME2 


Problem is how to allow apostrophes in names such as

O'Reilly or O'Dear !


Thanks, JimmyG

and Tom said...

to put a single quote in a literal, you use two of them together

' -ABCDEFGHIJKILMNOPQRSTUVWXYZ'''
                              ^^ that'll be a single quote really


Is this answer out of date? If it is, please let us know via a Comment