2

我在我的 ORACLE(10g) 数据库中使用以下查询。

SELECT * from student_table where student_no like '%STUDENT%' INTERSECT SELECT * from student_table where student_no in ('STUDENT1234','STUDENT5678')

我收到如下错误: java.sql.SQLSyntaxErrorException:ORA-00932:不一致的数据类型:预期 - 得到 CLOB

任何想法如何解决此错误?

4

2 回答 2

4

我猜student_table至少包含一列数据类型为 clob。

那时你不应该select *,但只有非 clob 列。

于 2011-02-16T09:59:01.607 回答
1

当结果集包含任何 LOB 时,您不能执行 INTERSECT。

但是,在这种情况下,无论如何您都不需要相交:

SELECT * from student_table
where student_no like '%STUDENT%'
and student_no in ('STUDENT1234','STUDENT5678');

而且,正如前面所指出的,在这个特定的例子中,第一个条件是多余的:

SELECT * from student_table where student_no in ('STUDENT1234','STUDENT5678');
于 2012-10-12T02:44:26.027 回答