确定
2015-10-09 09:15
采纳率: 100%
浏览 3.1k

oracle创建视图 报错 [Err] ORA-00905: missing keyword

SELECT
0 AS cpxx_id,
t_ckgl_wlcc.ccdbh AS djbh,
t_ckgl_wlcc.xgsj AS xgsj,
0 AS ycl_dhd_id,
t_ckgl_wlccmx.ccdmx_id AS ccdmx_id,
0 AS sctl_id,
0 AS zt,
t_ckgl_wlcc.zzjgdm AS zzjgdm,
(
SELECT
t_jygl_crcjy.zt AS jyjl
FROM
t_jygl_crcjy
WHERE
(
t_jygl_crcjy."ID" = t_ckgl_wlccmx.jydj_id
)
) AS jyjl,
t_ckgl_wlccmx.wl_id AS sccp_id,
t_ckgl_wlccmx.wlzl_bj AS cpbj,
t_ckgl_wlccmx.jydj_id AS crcjy_id,
t_ckgl_wlccmx.pch AS pch,
t_ckgl_wlccmx.txm AS txm,
t_cpgl_cpxx.cp_mc AS mc,
(
SELECT
t_jygl_crcjy.jydbh AS jydbh
FROM
t_jygl_crcjy
WHERE
(
t_jygl_crcjy."ID" = t_ckgl_wlccmx.jydj_id
)
) AS jydbh,
(
SELECT
t_jygl_crcjy.sfly AS sfly
FROM
t_jygl_crcjy
WHERE
(
t_jygl_crcjy."ID" = t_ckgl_wlccmx.jydj_id
)
) AS sfly,
(
CASE t_ckgl_wlccmx.cc_bj
WHEN 0 THEN
0
WHEN 1 THEN
0
WHEN 2 THEN
1
WHEN 3 THEN
1
WHEN 4 THEN
1
END
) AS jybj,
(
SELECT
t_jygl_crcjy.djyh_mc AS djyh_mc
FROM
t_jygl_crcjy
WHERE
(
t_jygl_crcjy."ID" = t_ckgl_wlccmx.jydj_id
)
) AS djyh_mc,
(
SELECT
t_jygl_crcjy.jysj AS jysj
FROM
t_jygl_crcjy
WHERE
(
t_jygl_crcjy."ID" = t_ckgl_wlccmx.jydj_id
)
) AS jysj,
t_ckgl_wlccmx.sc_bj AS sc_bj,
t_ckgl_wlcc.zf_bj AS zf_bj
FROM
(
(
t_ckgl_wlccmx
JOIN t_cpgl_cpxx
)
JOIN t_ckgl_wlcc
)
WHERE
(
(
t_ckgl_wlccmx.ccd_id = t_ckgl_wlcc.ccd_id
)
AND (
t_ckgl_wlccmx.wl_id = t_cpgl_cpxx.cp_id
)
AND (
t_ckgl_wlccmx.wlzl_bj = 2
)
AND (t_ckgl_wlccmx.cc_bj <> 0)
AND (t_ckgl_wlccmx.sc_bj <> 1)
AND (t_cpgl_cpxx.sc_bj <> 1)
AND (t_ckgl_wlcc.tjzt = 1)
)

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • WorldMobile 2015-10-10 00:50
    已采纳

    改成这样试试,应该是你的join用错了

    
     SELECT 0 AS cpxx_id,
           t_ckgl_wlcc.ccdbh AS djbh,
           t_ckgl_wlcc.xgsj AS xgsj,
           0 AS ycl_dhd_id,
           t_ckgl_wlccmx.ccdmx_id AS ccdmx_id,
           0 AS sctl_id,
           0 AS zt,
           t_ckgl_wlcc.zzjgdm AS zzjgdm,
           (SELECT t_jygl_crcjy.zt AS jyjl
              FROM t_jygl_crcjy
             WHERE (t_jygl_crcjy."ID" = t_ckgl_wlccmx.jydj_id))
              AS jyjl,
           t_ckgl_wlccmx.wl_id AS sccp_id,
           t_ckgl_wlccmx.wlzl_bj AS cpbj,
           t_ckgl_wlccmx.jydj_id AS crcjy_id,
           t_ckgl_wlccmx.pch AS pch,
           t_ckgl_wlccmx.txm AS txm,
           t_cpgl_cpxx.cp_mc AS mc,
           (SELECT t_jygl_crcjy.jydbh AS jydbh
              FROM t_jygl_crcjy
             WHERE (t_jygl_crcjy."ID" = t_ckgl_wlccmx.jydj_id))
              AS jydbh,
           (SELECT t_jygl_crcjy.sfly AS sfly
              FROM t_jygl_crcjy
             WHERE (t_jygl_crcjy."ID" = t_ckgl_wlccmx.jydj_id))
              AS sfly,
           (CASE t_ckgl_wlccmx.cc_bj
               WHEN 0 THEN 0
               WHEN 1 THEN 0
               WHEN 2 THEN 1
               WHEN 3 THEN 1
               WHEN 4 THEN 1
            END)
              AS jybj,
           (SELECT t_jygl_crcjy.djyh_mc AS djyh_mc
              FROM t_jygl_crcjy
             WHERE (t_jygl_crcjy."ID" = t_ckgl_wlccmx.jydj_id))
              AS djyh_mc,
           (SELECT t_jygl_crcjy.jysj AS jysj
              FROM t_jygl_crcjy
             WHERE (t_jygl_crcjy."ID" = t_ckgl_wlccmx.jydj_id))
              AS jysj,
           t_ckgl_wlccmx.sc_bj AS sc_bj,
           t_ckgl_wlcc.zf_bj AS zf_bj
      FROM t_ckgl_wlccmx, t_cpgl_cpxx, JOIN t_ckgl_wlcc
     WHERE (    (t_ckgl_wlccmx.ccd_id = t_ckgl_wlcc.ccd_id)
            AND (t_ckgl_wlccmx.wl_id = t_cpgl_cpxx.cp_id)
            AND (t_ckgl_wlccmx.wlzl_bj = 2)
            AND (t_ckgl_wlccmx.cc_bj <> 0)
            AND (t_ckgl_wlccmx.sc_bj <> 1)
            AND (t_cpgl_cpxx.sc_bj <> 1)
            AND (t_ckgl_wlcc.tjzt = 1))
    
    
    已采纳该答案
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题