查詢cad庫中,所有程序leg引用的點的id,需要預先處理點表和程序表
select f1.pro_id,f1.pro_type, f1.code_fix_point, f1.code_type_fix_point, f1.code_fir,f2.code_icao,
nvl
(
(select f3.significant_point_id from airway_point f3
where f3.code_id=f1.code_fix_point
and f3.code_icao=f2.code_icao
and f3.origin_type=f1.code_type_fix_point
and f3.isvalid=1
),
(select f4.significant_point_id from airway_point f4
where f4.code_id=f1.code_fix_point
and f4.code_fir_jep=f1.code_fir
and f4.origin_type=f1.code_type_fix_point
and f4.isvalid=1
and not exists --如果沒有此notexists段,會提示單條查詢返回多個結果。原以為前面的nvl會排除掉nvl中二者重復的記錄,但實際情況說明sql執行順序可能不是按nvl參數順序執行,可能是倒序執行
(
select f5.significant_point_id from airway_point f5
where f5.code_id=f1.code_fix_point
and f5.code_icao=f2.code_icao
and f5.origin_type=f1.code_type_fix_point
and f5.isvalid=1
)
)
)pnt
from procedure_leg f1, procedure f2
where f1.code_fix_point is not null
and f1.pro_id=f2.PRO_ID and f1.pro_type=f2.PRO_TYPE
查詢cad庫中,所有程序leg引用的點的id,需要預先處理點表和程序表