运行查询时出错,我的错误与CLOB有关。我找不到解决问题的方法。
我运行此查询:
SELECT wm_concat( employee.id_employe )
FROM decision decs
LEFT OUTER JOIN decision_to_employee dec_emp
ON dec_emp.id_decision = decs.id_decision
LEFT OUTER JOIN employee employee
ON dec_emp.id_employee = employee.id_employe
LEFT OUTER JOIN employee_lang employee_lang
ON employee.id_employe = employee_lang.id_employe
AND employee_lang.lang_emp_lang = 'ar'
WHERE decs.id_decision = 'DEC-29'
AND dec_emp.type_to = 'to'
AND dec_emp.id_decision = decs.id_decision
GROUP BY decs.id_decision
UNION
SELECT wm_concat( unit_lang.id_unit )
FROM decision decs
LEFT OUTER JOIN decision_to_unit dec_unit
ON dec_unit.id_decision = decs.id_decision
LEFT OUTER JOIN unit_lang
ON unit_lang.id_unit = dec_unit.id_unit
AND unit_lang.lang_unit_lang = 'ar'
WHERE decs.id_decision = 'DEC-29'
AND dec_unit.type_to = 'to'
AND dec_unit.id_decision = decs.id_decision
GROUP BY decs.id_decision
但我有这个错误:
[APP] WARN [http-8080-1] JDBCExceptionReporter.logExceptions(100) | SQL Error: 932, SQLState: 42000
[APP] ERROR [http-8080-1] JDBCExceptionReporter.logExceptions(101) | ORA-00932: inconsistent datatypes ; expected: - ; got : CLOB
我认为在我的查询中使用Union
时会出现此错误。
已更新:
decision :
ID_DECISION : varchar2(15)
TEXT_DECISION : varchar2(4000)
NB_PAGE_DECISION : varchar2(15)
SUBJECT_DECISION : varchar2(15)
DATE_CREATE : date
USER_CREATE : varchar2(15)
NUM_ORDRE_DECISION : varchar2(20)
DATE_JC_DECISION : date
DATE_HJR_DECISION : varchar2(15)
TYPE_RECEIVE : varchar2(1)
DATE_RECEIVE : date
USER_RECEIVE : varchar2(15)
ID_TYP_CORRESP : varchar2(15)
ID_FOLDER : varchar2(15)
DOC_LINK_CORRESP : varchar2(15)
employee :
ID_EMPLOYE : varchar2(15)
ID_JOB : varchar2(15)
ID_JOB : varchar2(15)
TEL_EMPLOYE : varchar2(15)
FAX_EMPLOYE : varchar2(15)
MAIL_EMPLOYE : varchar2(100)
STATUT : varchar2(1)
CONFIDENTIEL : varchar2(1)
NUM_IDENTITY : varchar2(15)
ID_PORTAL : varchar2(100)
employee_lang :
ID_EMP_LANG : varchar2(15)
ID_EMPLOYE : varchar2(15)
FULLNAME_EMP_LANG : varchar2(500)
ADDRESS_EMP_LANG : varchar2(500)
LANG_EMP_LANG : varchar2(5)
MATRICULE_EMP : varchar2(10)
decision_to_employee
ID_DECISION : varchar2(15)
ID_EMPLOYEE : varchar2(15)
TYPE_TO : varchar2(5)
decision_to_unit :
ID_DECISION : varchar2(15)
ID_UNIT : varchar2(15)
TYPE_TO : varchar2(5)
unit_lang :
ID_UNIT_LANG : varchar2(15)
ID_UNIT : varchar2(15)
ADDRESS_UNIT_LANG : varchar2(500)
NBR_UNIT_LANG : varchar2(15)
NAME_UNIT_LANG : varchar2(500)
ABBREVIATED_NAME_UNIT : varchar2(15)
LANG_UNIT_LANG : varchar2(5)
答案 0 :(得分:0)
我认为您的查询有几个问题:
varchar
与numeric
进行比较,这是错误的:decs.id_decision = 'DEC-29'
。wm_concat
,这是未记录的。请改用listagg
。decs.id_decision
进行分组而不在结果中使用它,这对我没有任何意义。答案 1 :(得分:0)
您应该使用UNION ALL而不是UNION 请参阅Ask Tom回复此错误