做论坛类网站时,会遇到主题表和回复表的内容字段都为clob字段,此时要取出一个贴子时,会使用到union,它这时会报ORA-00932 不一致的数据类型 要求 -得到的却是clob错误。
原因是:lob字段不能做group by,而union中需要使用group by过滤到重复纪录,所以不行
解决方法:用union all就可以了
select title, content, writerid, writer, speechtime, points, faceid, point, gold, idiographp, idiographt from (( select title, content, writerid, writer, speechtime, points from vo_bbstopictab where topicid = '1153996430976t2cj0' ) union all (select title, content, writerid, writer, speechtime, points from vo_bbsreplytab where topicid = '1153996430976t2cj0')), vo_usertab where writerid = userid order by speechtime
|