我正在创建一个表,但遇到一个错误,提示我缺少右括号。
我看了看我的剧本,发现没有什么丢失。
create table lalala as (
select distinct tc.riser_fid, tc.cbl_fid AS ZH_CBL_FID, FH.CABLE_NO AS ZH_CABLE_NO, FCH2.CHANNEL_SEQ_NO AS ZH_STRAND_NO,
fmh.facility_id as ZH_FACILITY_ID, tc.cbl_ownership AS ZH_CBL_OWNERSHIP, FMG.FACILITY_ID AS ZG_FACILITY_ID,
FMG.FACILITY_NAME AS ZG_FACILITY_NAME, FCG1.CHANNEL_SEQ_NO AS ZG_STRAND_NO,ft2.A_SITE_ID as A_SITE_ID, ft2.B_SITE_ID as B_SITE_ID
from sgtel10.total_cables tc
join gc_fcbl_temp FH ON FH.G3E_FID = tc.cbl_fid and fh.ltt_id in (0,888888888)
left join facility_master_temp fmh on fmh.facility_name = fh.cable_no
left join facility_master_temp fmh on fmh.facility_name || 'P' = fh.cable_no
left join facility_master_temp fmh on fmh.facility_name || 'A' = fh.cable_no
left join facility_master_temp fmh on fmh.facility_name || 'Z' = fh.cable_no
left join facility_master_temp fmh on fmh.facility_name || 'AP' = fh.cable_no
join facility_channel_temp fch2 on fch2.facility_id = fmh.facility_id and fch2.CHANNEL_REF IS NOT NULL
left JOIN FACILITY_TRAIL_ITEMS_TEMP ft on ft.facility_trail_itm_id = fch2.facility_trail_itm_id
left JOIN FACILITY_TRAIL_ITEMS_TEMP ft2 on ft2.parent_fac_trl_itm_id = ft.parent_fac_trl_itm_id and ft2.trail_seq_no = 1.0
left join facility_channel_temp FCG1 ON FCG1.CHANNEL_ID = ft2.asgn_channel_id and FCG1.CHANNEL_SEQ_NO IS NOT NULL
left join facility_master_temp fmg on fmg.facility_id = fcg1.facility_id
order by fmh.facility_id, FCH2.CHANNEL_SEQ_NO
);
答案 0 :(得分:1)
ORDER BY
子句没有任何意义,实际上可能是错误的根源。因此,请尝试将其删除。 ORDER BY
毫无意义的原因是SQL表本质上是无序的。 ORDER BY
仅适用于从表中选择和显示的情况。
编辑:如果您使用Oracle的ORDER BY
语法以这种顺序仅选择一定数量的行,则FETCH
可能有意义。但是,由于您的查询不是 这样做的,因此ORDER BY
不合适。