Error ORA-00932 when using a select with union and CLOB fields(使用带有联合和 CLOB 字段的选择时出现 ORA-00932 错误)
问题描述
首先,这不是这个 问题.如果是,抱歉,我无法通过阅读来解决我的问题.
First of all, this isn't a duplicate of this question. If it is, sorry but I couldn't solve my problem by reading it.
我收到此错误:
ORA-00932: inconsistent datatypes: expected - got CLOB
当我尝试执行这个 SELECT 语句时:
When I try to execute this SELECT statement:
SELECT TXT.t_txt
FROM CITADM.tb_avu_txt_grc GR
INNER JOIN CITADM.tb_avu_txt TXT
ON (GR.e_txt = TXT.e_txt and GR.u_txt = TXT.u_txt)
WHERE TXT.u_lin_ord = 1
UNION
SELECT TXT.t_txt
FROM CITADM.tb_avu_txt_grc_cvd GRC
INNER JOIN CITADM.tb_avu_txt TXT
ON (GRC.e_txt = TXT.e_txt and GRC.u_txt = TXT.u_txt)
WHERE TXT.u_lin_ord = 2
所选字段(t_txt) 是CLOB 数据类型.如您所见,它是同一个表的同一列.这个声明属于一个更大的声明,我已经隔离了我遇到这个问题的部分.
The selected field(t_txt) is of CLOB datatype. As you can see, it's the same column of the same table. This statement belongs to a bigger one, I've isolated the part where I'm having this problem.
非常感谢.
推荐答案
我认为问题在于使用了 UNION 而不是 UNION ALL.UNION 运算符将组合两个集合并消除重复项.由于无法比较 CLOB 类型,因此无法进行重复消除部分.
I believe the problem is the use of UNION instead of UNION ALL. The UNION operator will combine the two sets and eliminate duplicates. Since CLOB types cannot be compared, the duplicate elimination part is not possible.
使用 UNION ALL 不会尝试进行重复消除(反正你可能没有重复)所以它应该可以工作.
Using UNION ALL won't attempt to do duplicate elimination (you probably don't have duplicates anyways) so it should work.
这篇关于使用带有联合和 CLOB 字段的选择时出现 ORA-00932 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用带有联合和 CLOB 字段的选择时出现 ORA-00932 错误
基础教程推荐
- 在 SQL 中连接多个表 2021-01-01
- 需要 MySQL 5.1 中的抽象触发器来更新审计日志 2021-01-01
- 如何使用 mysql.connector 禁用查询缓存 2022-01-01
- 是否可以执行按位分组功能? 2021-01-01
- SQL Server 实例在登录协商期间返回无效或不受支持的协议版本 2021-01-01
- SQL:使用来自具有相同列名的两个表中的数据... 2021-01-01
- 将 SQL Server DateTime 列迁移到 DateTimeOffset 2021-01-01
- SQL 效率:WHERE IN 子查询 vs. JOIN 然后 GROUP 2021-01-01
- 无法解决整理冲突 2021-01-01
- SSMS 中的权限问题:“对象 'extended_properties'、数据库 'mssqlsystem_resource'、... 错误 229)上的 SELECT 权限被拒绝" 2022-01-01
