当运行以下SQL查询时,我收到消息:
ORA-00907: missing right parenthesis
00907. 00000 - "missing right parenthesis"
*Cause:
*Action:
Error at Line: 32 Column: 18
我最近在查询中添加了dv6.long_name toll_system_type,所以我知道它与之有关,因为之前工作正常。
这是SQL:
with t as (SELECT DISTINCT dv6.long_name toll_system_type,
ti.tollsystem_id,
ti.toll_id,
pp.type,
dv.published_value,
nvl(dv.long_name, 'N/A') paypoint_type,
pp.map_id,
pp.map_id_entry,
nvl(dv2.long_name, 'N/A') tollpaymentmethod,
c.currency,
c.accuracy,
c.per_distance,
nvl(dv3.long_name, 'N/A') currencytype ,
COUNT (DISTINCT ti.toll_id) count_Toll_ID,
(COUNT (DISTINCT c.cost_id)) count_costid,
MIN(asr.subregion) AS region
FROM
WEU_bw_.TC_TOLL_ID ti,
WEU_bw_.TC_PAYPOINT pp,
WEU_bw_.nt_domain_value dv,
WEU_bw_.tc_cost_paymethod cp,
WEU_bw_.nt_domain_value dv2,
WEU_bw_.tc_cost c,
WEU_bw_.nt_domain_value dv3,
WEU_bw_.nt_condition con,
WEU_bw_.nt_nav_strand ns,
WEU_bw_.nt_nav_link nl,
WEU_bw_.nt_link l,
WEU_bw_.qt_admin_subregions asr
WEU_bw_.nt_domain_value dv6,
WHERE ti.toll_id = pp.toll_id
AND pp.map_id = con.multi_nav_pvid(+)
AND con.strand_id = ns.nav_strand_id(+)
AND ns.nav_link_id = nl.nav_link_id(+)
AND nl.link_id = l.link_id(+)
AND l.left_admin_place_id = asr.admin_place_id(+)
AND ti.toll_id = c.toll_id
AND c.cost_id = cp.cost_id (+)
AND dv.domain_id = 1999567214
AND dv.value(+) = pp.type
AND dv2.domain_id(+) = 1994328351
AND dv2.value(+) = cp.type
AND dv3.domain_id = 1994571604
AND dv3.value(+) = c.currency
AND dv6.domain_id(+) = 1995788373
AND dv6.value(+) = ti.tollsystem_id
GROUP BY ti.tollsystem_id,
ti.tollsystem_id,
ti.toll_id,
pp.type,
dv.published_value,
dv.long_name,
pp.map_id,
pp.map_id_entry,
dv2.long_name,
c.currency,
dv3.long_name,
c.accuracy,
c.per_distance
ORDER BY 1)
SELECT DISTINCT
t.tollsystem_id,
t.toll_id,
t.type,
t.published_value,
t.paypoint_type,
t.map_id,
t.map_id_entry,
t.currency,
t.per_distance,
t.currencytype ,
t.count_Toll_ID,
t.region
FROM t
答案 0 :(得分:5)
你有一个额外的逗号和一个缺少的逗号:
FROM
WEU_bw_.TC_TOLL_ID ti,
WEU_bw_.TC_PAYPOINT pp,
WEU_bw_.nt_domain_value dv,
WEU_bw_.tc_cost_paymethod cp,
WEU_bw_.nt_domain_value dv2,
WEU_bw_.tc_cost c,
WEU_bw_.nt_domain_value dv3,
WEU_bw_.nt_condition con,
WEU_bw_.nt_nav_strand ns,
WEU_bw_.nt_nav_link nl,
WEU_bw_.nt_link l,
WEU_bw_.qt_admin_subregions asr --Add the comma here
WEU_bw_.nt_domain_value dv6, --Remove the comma from here