All Forums Database
ejsk 3 posts Joined 04/14
27 Jul 2015
Finding and Flagging a record with Non-Latin Characters

Hi TD Experts -
My background is in SQL Server and have been recently a migrant to TD.  My question is:
 
I need to identify if a record contains a non-Latin character.  This is not a do something once found, but a simple if the character exists, return 1, else 0. 
 
I imagine I am overthinking this - and tried a couple of find functions - with no success.
Any Ideas?

dnoeth 4628 posts Joined 11/04
27 Jul 2015

How do you define "non-Latin", a character not from the LATIN charset? 
TRANSLATE_CHK(col USING UNICODE_TO_LATIN) returns the position of the 1st non-Latin character (or zero).
Otherwise you might try a regular expression:
regexp_similar(col,'.*\W+.*') returns 0 if the only characters are  'a'-'z','0'-'9' and '_', otherwise 1. This can be easily changed to any list of allowed characters.

Dieter

ejsk 3 posts Joined 04/14
27 Jul 2015

Actually the first will work just fine!  I can create a case statement out of it and as long as it >0, and <>'' should be just fine!
 
Appreciate the help.

You must sign in to leave a comment.