当oracle clob类型不能和groupby并用,但是需要去除多列重复,请不要急!
直接看SQL:
SELECT T.MEMBER,
T.HTEST,
T.ACCEPTDATE,
T.TASKMEMO,
T.ACCEPTER,
T.TASKID,
T.ACCEPTRESULT,
T.OVERHAULRESULT,
T.OVERHAULCONTENT,
T.EQUIPMENTID ,
T.TASKLEVEL,
T.LEADER,
T.TASKNAME,
T.BEGINDATE,
T.ENDDATE,
T.PIOCONTENT,
V.GUOLUNAME,V.FENLEINAME
FROM V_GL_6JI V,T_OVERHUALTASK_TASK T
WHERE T.EQUIPMENTID=V.FENLEIID AND T.TASKID = 10000039104 GROUP BY T.MEMBER,T.HTEST,
T.ACCEPTDATE,
T.TASKMEMO, T.ACCEPTER,
T.TASKID, T.ACCEPTRESULT,
T.OVERHAULRESULT, T.OVERHAULCONTENT,
T.EQUIPMENTID , T.TASKLEVEL,
T.LEADER, T.TASKNAME, T.BEGINDATE, T.ENDDATE,
T.PIOCONTENT,
V.GUOLUNAME,V.FENLEINAME
但是会报如下错
ORA-00932: 数据类型不一致: 应为 -, 但却获得 CLOB
00932. 00000 - "inconsistent datatypes: expected %s got%s"
*Cause:
*Action:
行 19 列 89 出错
解决办法,不用group by
Sql如下:
SELECT T.MEMBER,
T.HTEST,
T.ACCEPTDATE,
T.TASKMEMO,
T.ACCEPTER,
T.TASKID,
T.ACCEPTRESULT,
T.OVERHAULRESULT,
T.OVERHAULCONTENT,
T.EQUIPMENTID ,
T.TASKLEVEL,
T.LEADER,
T.TASKNAME,
T.BEGINDATE,
T.ENDDATE,
T.PIOCONTENT,
(select v.FENLEINAME fromV_GL_6JI v where v.FENLEIID= T.EQUIPMENTID group by v.FENLEINAME) asFENLEINAME,
(select v.GUOLUNAME fromV_GL_6JI v where v.FENLEIID= T.EQUIPMENTID group by v.GUOLUNAME) as GUOLUNAME
FROM T_OVERHUALTASK_TASK T
WHERE T.TASKID = 10000039104
办法虽然有点笨,但是可以解决问题
版权声明:本文为博主原创文章,未经博主允许不得转载。
来源:oschina
链接:https://my.oschina.net/u/4312590/blog/4446589