---
title: Oracle 租户语句 like 加 `%` 过滤繁体字报错 missing or illegal character following the escape character 的原因和解决方法-OceanBase数据库使用指南
description: 了解OceanBase数据库在实际应用中关于Oracle 租户语句 like 加 `%` 过滤繁体字报错 missing or illegal character following the escape character 的原因和解决方法相关的常见问题和使用技巧，帮助您快速解决Oracle 租户语句 like 加 `%` 过滤繁体字报错 missing or illegal character following the escape character 的原因和解决方法的难题。
---
切换语言

- 中文站 - 简体中文
- International - English
- 日本站 - 日本語

划线反馈

# Oracle 租户语句 like 加 `%` 过滤繁体字报错 missing or illegal character following the escape character 的原因和解决方法

更新时间：2026-06-10 01:56

适用版本： V3.1.x、V3.2.x 内容类型：Troubleshoot  

## 问题现象

Oracle 租户 gbk 字符集，执行语句 like + 模糊查询繁体字报错 `missing or illegal character following the escape character`，如下图所示。

![image001](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/knowledge-base/database/sql/20241025orclmissingillegalcharacter001.png)

关键日志信息如下。

```shell
observer.log.20241021140406:[2024-10-21 14:03:35.529413] WARN  [SQL.ENG] check_pattern_valid (ob_expr_like.cpp:220) [2813162][0][xxxxx-xxxxx-xxxxx-xxxxx] [lt=14] [dc=0] missing or illegal character following the escape character(escape_val=\, pattern_val=%?\\??%, ret=-5665)
observer.log.20241021140406:[2024-10-21 14:03:35.529434] WARN  [SQL.ENG] like_varchar (ob_expr_like.cpp:808) [2813162][0][xxxxx-xxxxx-xxxxx-xxxxx] [lt=15] [dc=0] fail to check pattern string(pattern={len: 7, ptr: 0x7eb0bb56be46, hex: 25D55C5CBACF25}, escape={len: 1, ptr: 0x7e23ef98bb90, hex: 5C, cstr: \}, coll_type=87)

```

通过日志中的 Hex（十六进制） 转换，如下图所示。

![image002](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/knowledge-base/database/sql/20241025orclmissingillegalcharacter002.png)

## 问题原因

该问题属于 OceanBase 数据库缺陷，导致在查询的时候字符集的编码解析出现问题，中间出现了转义字符 `\`。

## 问题的风险及影响

导致执行语句报错 `missing or illegal character following the escape character`。

## 影响租户

影响 OceanBase 数据库中的 Oracle 租户，对于 SYS 租户和 MySQL 租户无影响

## 适用版本

OceanBase 数据库 V3.x 版本。

## 解决方法及规避方式

在 like 后使用 `escape '\'`，如下所示。

```shell
SELECT * FROM lcinsured WHERE insuredname LIKE '%誠合%'  escape '\';

```

上一篇

[关于 SYS 租户的资源单元个数的建议](https://www.oceanbase.com/knowledge-base/oceanbase-database-1000000000210114)

下一篇

[observer.log 中 dump tenant 介绍](https://www.oceanbase.com/knowledge-base/oceanbase-database-20000000057) ![有帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*y6ocSqN8cqsAAAAAAAAAAAAAARQnAQ)![无帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*BG9IQJyLHF8AAAAAAAAAAAAAARQnAQ)![反馈](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*eTWdQKCRKHwAAAAAAAAAAAAAARQnAQ)[AI](https://www.oceanbase.com/obi) 咨询热线
