|
|
Re: How to replace with null for non alphanumeric characters in Varchar2 field. [message #667642 is a reply to message #667636] |
Tue, 09 January 2018 06:46   |
 |
msol25
Messages: 396 Registered: June 2011
|
Senior Member |
|
|
Thanks Michel,
I should have the list of special characters in advance which is coming in the field. But, I have millions of records and difficult to find out the non english characters in each field.I find out few characters in below query and used to check the incoming data in field:
select *
from test_tab
where regexp_like(field_name,'(Å|Ã|¶|Ž|¿|\+||||Â|M)');
Output:
Filed_name
----------
1 SŽN Y GWYNT
2 CWM DŽR COTTAGE
3 SŽN Y GWYNT
1 SŽN YR AFON
2 HAUL A MR
1 SŽN Y MR
GLAN Y MR
8 SŽN Y WYLAN
But, Still scared if some other characters will also be coming then we have to execute the script in production once again.So, Just want to know is there possibility to remove non-alphanumeric characters without passing list of identified junk characters for replacement?.
[Updated on: Tue, 09 January 2018 06:48] Report message to a moderator
|
|
|
|
|
|
Re: How to replace with null for non alphanumeric characters in Varchar2 field. [message #667790 is a reply to message #667646] |
Tue, 16 January 2018 02:57  |
 |
msol25
Messages: 396 Registered: June 2011
|
Senior Member |
|
|
Thanks Michel,
I can use translate function for getting junk characters and replace those characters.I created below query for finding any other special incoming characters in the table column.If we find any character is valid then we can pass that character into our lookup list.If not, then we can find the list of junk characters for a specific field in the table.I hope, below query can also helpful for my other colleagues to find junk characters in a specific table column.
select col_junk
,count(1)
from
(
select tst.col_val
,translate(col_val,'#0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz()[]-.\, ','#') as col_junk
from test_table tst
)
group by col_junk;
|
|
|