Search This Blog

Friday, January 30, 2015

How to find extended ASCII characters present in a string.

Lets take an example of ADDRESS record in PeopleSoft.
To identify extended ASCII character first we need to know the ASCII characters range.
ASCII characters range is from 0 - 255 and of them extended ASCII characters range is from 128 to 255.

Let's see the character value of ASCII code 229.

select chr(229) from dual;
Output: å

Below SQL will help us in getting the non-ASCII charactes.

SQL to execute:
select * from ps_addresses where regexp_like(address1,'['||chr(128)||'-'||chr(255)||']');

If we observe, chr function is used to identify the ascii character value and iphen  is used to get range (similar to BETWEEN and AND )

The above SQL will get all the rows that have extended ASCII characters present in address1 field.


No comments: