简体   繁体   中英

SQL Special Characters on Tables

we are using following SQL to identify several rows which contain only SPECIAL CHARACTERs 'F@C(!!'. But seems it's not capturing some SPECIAL CHARACTER like 'F@C(!!'. Script should capture only special characters. Could you please share the optimized script to use for this scenario case

       when regexp_like(column_name '^[^a-zA-Z]*$') then 'number'
       when regexp_like(column_name, '^[^g-zG-Z]*$') then 'hex'
       else 'string'

end

Try removing the ^ and $ anchors from the regex pattern you are using with regexp_like :

select *
from your_table
where regexp_like(column_name, '[^a-zA-Z]');

The above logic would check for the presence of one or more characters which are not letters. If you instead want to check for non alphanumeric, then use [^A-Za-z0-9] .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM