使用带有联合和 CLOB 字段的选择时出现 ORA-00932 错误

2023-11-03数据库问题
7

本文介绍了使用带有联合和 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 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

SQL 子句“GROUP BY 1"是什么意思?意思是?
What does SQL clause quot;GROUP BY 1quot; mean?(SQL 子句“GROUP BY 1是什么意思?意思是?)...
2024-04-16 数据库问题
62

为什么 Mysql 的 Group By 和 Oracle 的 Group by 行为不同
Why Mysql#39;s Group By and Oracle#39;s Group by behaviours are different(为什么 Mysql 的 Group By 和 Oracle 的 Group by 行为不同)...
2024-04-16 数据库问题
13

如何在MySQL中为每个组选择第一行?
How to select the first row for each group in MySQL?(如何在MySQL中为每个组选择第一行?)...
2024-04-16 数据库问题
13

MySQL - 获取最低值
MySQL - Fetching lowest value(MySQL - 获取最低值)...
2024-04-16 数据库问题
8

在 cmakelist.txt 中添加和链接 mysql 库
Add and link mysql libraries in a cmakelist.txt(在 cmakelist.txt 中添加和链接 mysql 库)...
2024-04-16 数据库问题
41

定义外键有什么好处
what are the advantages of defining a foreign key(定义外键有什么好处)...
2024-04-16 数据库问题
7