oracle - 在单字节字符集环境中存储多字节字符 oracle 12c
问题描述
早些时候,我们将JSON
包含最新10
对话的内容存储NCLOB
在数据库的列中以用于缓存目的。但现在我们必须以JSON
格式存储所有对话并提供搜索功能。为了利用 oracle 的文本搜索,我们尝试使用BLOB
datatype 而不是NCLOB
. 然而,我们面临着存储多字节字符和搜索它的问题。关于如何使用BLOB
数据类型的任何建议?
这是我正在尝试的一个例子
--创建带有blob列的表--
create table departments_json (
department_id integer not null primary key,
department_data blob not null
);
---添加JSON检查约束---
alter table departments_json
add constraint dept_data_json
check ( department_data is JSON FORMAT JSON STRICT );
---------------用于文本搜索的索引 json 列-------
create index deptj_ctx_ix on departments_json (department_data)
indextype is ctxsys.context parameters ('section group CTXSYS.JSON_SECTION_GROUP sync (on commit)');
--插入带有多字节字符的Json
insert into departments_json
values ( 100, utl_raw.cast_to_raw ('{"department_list":[{"Deptname":"DEPT-A", "value" : "məharaːʂʈrə"}]}'));
插入失败: ORA-02290:违反检查约束 (REGCOA_SPM.DEPT_DATA_JSON)
解决方案
推荐阅读
- firebase - 服务器端迁移到 FCM,但客户端将在 2019 年 4 月 11 日之后将 GCM 与 InstanceID.getToken() 一起使用
- excel - Excel 查找和替换无法按预期工作
- gcc - __attribute__((io)), __attribute__((address)) 在 AVR 的 gcc 中似乎没有任何效果
- android - 无法读取 android 调试密钥
- loopback - 在 Quagga 中连接 eBGP 和 iBGP 路由器
- javascript - 使用 ReactQuill 库禁用任何用户输入
- c# - 如何在部分视图中获取浏览器查询字符串
- webpack - Webpack 4:无法解决符号链接模块的依赖关系
- c# - 使用委托绘制形状
- python - 如何在keras中将三维数组转换为五维数组