ORACLE語句 inconsistent datatypes: expected - got CLOB
阿新 • • 發佈:2018-11-29
SELECT
*
FROM
(
SELECT
A . ID,
A .user_name AS "userName",
A .user_pwd AS "userPwd",
A . NAME AS "name",
A .user_sex AS "userSex",
A .user_image AS "userImage",
A .idcard_no AS "idcardNo",
A .user_tel AS "userTel",
A .status AS "status",
A .create_dt AS "createDate",
A .update_dt AS "updateDate",
A .deptorg_id AS "deptorgId",
A .grid_id AS "mngGrid.id",
A .edit_time AS "editTime",
A .is_online AS "isLogin",
A .role_ids AS "roleIds",
A .role_Names AS "roleNames",
D . ID AS "dept.id",
D .dorg_name AS "dept.dorgName",
D .DEPT_LEVEL AS "dept.deptLevel",
G .org_name AS "mngGrid.orgName",
G .org_code AS "mngGrid.orgCode",
G .admin_level AS "mngGrid.adminLevel",
G .parent_id AS "mngGrid.parent.id",
G .parent_orgName AS "mngGrid.parent.orgName",
G .view_name AS "mngGrid.viewName",
(
CASE
WHEN A .deptorg_id IS NOT NULL THEN
0
WHEN (
A .deptorg_id IS NULL
AND G .admin_level >= 4
) THEN
1
WHEN (
A .deptorg_id IS NULL
AND G .admin_level = 3
) THEN
2
WHEN (
A .deptorg_id IS NULL
AND G .admin_level = 2
) THEN
3
WHEN (
A .deptorg_id IS NULL
AND G .admin_level = 1
AND A .role_ids != '1'
) THEN
4
ELSE
9
END
) AS "roleType"
FROM
mng_tb_user A
LEFT JOIN mng_tb_user P ON A .creator_id = P . ID
LEFT JOIN (
SELECT
ctp.user_id,
wm_concat (ctp.grid_id) AS ID,
MAX (gd.parent_id) AS parent_id,
MAX (P .org_name) AS parent_orgName,
wm_concat (gd.org_code) AS org_code,
wm_concat (gd.view_name) AS view_name,
wm_concat (gd.org_name) AS org_name,
MAX (gd.admin_level) AS admin_level
FROM
cm_tb_user_precinct_relation ctp
LEFT JOIN mng_tb_grid gd ON ctp.grid_id = gd. ID
LEFT JOIN mng_tb_grid P ON gd.parent_id = P . ID
WHERE
gd.del_flag = 0
AND ctp.del_flag = 0
GROUP BY
ctp.user_id
) G ON A . ID = G .user_id
LEFT JOIN mng_tb_dept_org D ON A .deptorg_id = D . ID
WHERE
A .status = 1
AND EXISTS (
SELECT
role_id
FROM
mng_tb_role_right b
LEFT JOIN mng_tb_right r ON b.right_id = r. ID
WHERE
r.parent_id = '1'
AND r.del_flag = 0
AND r.sys_id = 'SYS0020'
AND ',' || A .role_ids || ',' LIKE '%,' || b.role_id || ',%'
)
AND G .org_code LIKE 'DE'|| '%'
AND G .org_code LIKE 'E'|| '%'
ORDER BY
G .org_name DESC
)
WHERE
*
FROM
(
SELECT
A . ID,
A .user_name AS "userName",
A .user_pwd AS "userPwd",
A . NAME AS "name",
A .user_sex AS "userSex",
A .user_image AS "userImage",
A .idcard_no AS "idcardNo",
A .user_tel AS "userTel",
A .status AS "status",
A .create_dt AS "createDate",
A .update_dt AS "updateDate",
A .deptorg_id AS "deptorgId",
A .grid_id AS "mngGrid.id",
A .edit_time AS "editTime",
A .is_online AS "isLogin",
A .role_ids AS "roleIds",
A .role_Names AS "roleNames",
D . ID AS "dept.id",
D .dorg_name AS "dept.dorgName",
D .DEPT_LEVEL AS "dept.deptLevel",
G .org_name AS "mngGrid.orgName",
G .org_code AS "mngGrid.orgCode",
G .admin_level AS "mngGrid.adminLevel",
G .parent_id AS "mngGrid.parent.id",
G .parent_orgName AS "mngGrid.parent.orgName",
G .view_name AS "mngGrid.viewName",
(
CASE
WHEN A .deptorg_id IS NOT NULL THEN
0
WHEN (
A .deptorg_id IS NULL
AND G .admin_level >= 4
) THEN
1
WHEN (
A .deptorg_id IS NULL
AND G .admin_level = 3
) THEN
2
WHEN (
A .deptorg_id IS NULL
AND G .admin_level = 2
) THEN
3
WHEN (
A .deptorg_id IS NULL
AND G .admin_level = 1
AND A .role_ids != '1'
) THEN
4
ELSE
9
END
) AS "roleType"
FROM
mng_tb_user A
LEFT JOIN mng_tb_user P ON A .creator_id = P . ID
LEFT JOIN (
SELECT
ctp.user_id,
wm_concat (ctp.grid_id) AS ID,
MAX (gd.parent_id) AS parent_id,
MAX (P .org_name) AS parent_orgName,
wm_concat (gd.org_code) AS org_code,
wm_concat (gd.view_name) AS view_name,
wm_concat (gd.org_name) AS org_name,
MAX (gd.admin_level) AS admin_level
FROM
cm_tb_user_precinct_relation ctp
LEFT JOIN mng_tb_grid gd ON ctp.grid_id = gd. ID
LEFT JOIN mng_tb_grid P ON gd.parent_id = P . ID
WHERE
gd.del_flag = 0
AND ctp.del_flag = 0
GROUP BY
ctp.user_id
) G ON A . ID = G .user_id
LEFT JOIN mng_tb_dept_org D ON A .deptorg_id = D . ID
WHERE
A .status = 1
AND EXISTS (
SELECT
role_id
FROM
mng_tb_role_right b
LEFT JOIN mng_tb_right r ON b.right_id = r. ID
WHERE
r.parent_id = '1'
AND r.del_flag = 0
AND r.sys_id = 'SYS0020'
AND ',' || A .role_ids || ',' LIKE '%,' || b.role_id || ',%'
)
AND G .org_code LIKE 'DE'|| '%'
AND G .org_code LIKE 'E'|| '%'
ORDER BY
G .org_name DESC
)
WHERE
ROWNUM <= 20;
以上是oracel查詢語句 執行報inconsistent datatypes: expected - got CLOB
處理辦法:去掉了語句中的 ORDER BY G .org_name DESC 就不報錯了 不知道為什麼?求大神指教