从 Oracle Varchar2 中查找和删除非 ASCII 字符

Finding and removing Non-ASCII characters from an Oracle Varchar2(从 Oracle Varchar2 中查找和删除非 ASCII 字符)
本文介绍了从 Oracle Varchar2 中查找和删除非 ASCII 字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们目前正在将我们的一个 oracle 数据库迁移到 UTF8,我们发现了一些接近 4000 字节 varchar 限制的记录.当我们尝试迁移这些记录时,它们会失败,因为它们包含变成多字节 UF8 字符的字符.我想要在 PL/SQL 中做的是找到这些字符以查看它们是什么,然后更改它们或删除它们.

We are currently migrating one of our oracle databases to UTF8 and we have found a few records that are near the 4000 byte varchar limit. When we try and migrate these record they fail as they contain characters that become multibyte UF8 characters. What I want to do within PL/SQL is locate these characters to see what they are and then either change them or remove them.

我想做:

SELECT REGEXP_REPLACE(COLUMN,'[^[:ascii:]],'')

但是 Oracle 没有实现 [:ascii:] 字符类.

but Oracle does not implement the [:ascii:] character class.

有没有一种简单的方法可以做我想做的事情?

Is there a simple way doing what I want to do?

推荐答案

在单字节 ASCII 兼容编码(例如 Latin-1)中,ASCII 字符只是 0 到 127 范围内的字节.所以你可以使用一些东西像 [x80-xFF] 来检测非 ASCII 字符.

In a single-byte ASCII-compatible encoding (e.g. Latin-1), ASCII characters are simply bytes in the range 0 to 127. So you can use something like [x80-xFF] to detect non-ASCII characters.

这篇关于从 Oracle Varchar2 中查找和删除非 ASCII 字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

SQL to Generate Periodic Snapshots from Transactions Table(用于从事务表生成定期快照的SQL)
MyBatis support for multiple databases(MyBatis支持多个数据库)
Oracle 12c SQL: Missing column Headers in result(Oracle 12c SQL:结果中缺少列标题)
SQL query to find the number of customers who shopped for 3 consecutive days in month of January 2020(查询2020年1月连续购物3天的客户数量)
How to get top 10 data weekly (This week, Previous week, Last month, 2 months ago, 3 month ago)(如何每周获取前十大数据(本周、前一周、上个月、2个月前、3个月前))
Select the latest record for an Id per day - Oracle pl sql(选择每天ID的最新记录-Oracle pl SQL)