I am using the following query in my ORACLE(10g) DB.
SELECT * from student_table where student_no like '%STUDENT%' INTERSECT SELECT * from student_table where student_no in ('STUDENT1234','STUDENT5678')
I got error like: java.sql.SQLSyntaxErrorException: ORA-00932: inconsistent datatypes: expected - got CLOB
Any Idea how to resolve this Error开发者_StackOverflow中文版?
I guess student_table
contains at least one column with datatype clob.
You shoul not select *
then, but only the non-clob columns.
You can't do an INTERSECT when the result set includes any LOB.
In this case, however, you don't need the intersect anyway:
SELECT * from student_table
where student_no like '%STUDENT%'
and student_no in ('STUDENT1234','STUDENT5678');
And, as pointed out earlier, the first condition is redundant anyway in this particular instance:
SELECT * from student_table where student_no in ('STUDENT1234','STUDENT5678');
精彩评论