带有调试查询的Oracle Query错误

时间:2016-03-23 10:42:52

标签: oracle

调试查询时,出现错误

  

ORA-00923:未找到FROM关键字

以下是我的调试查询

SELECT pn.lease_num,
       hz.party_name,
       flt.location_code,
       flt.office flat_no,
       NULL action,
       la.no_of_days,
       NULL remarks,
       flt.location_id flat_id,
       pn.lease_id,
       prop.property_id = '1', bld.location_id building_id = '1309' 
  FROM xxcus.xxacl_pn_leases_all la,
       pn_leases_all pn,
       (SELECT *
          FROM pn_locations_all flat
         WHERE SYSDATE BETWEEN flat.active_start_date AND flat.active_end_date) bld,
       (SELECT *
          FROM pn_locations_all flat
         WHERE SYSDATE BETWEEN flat.active_start_date AND flat.active_end_date) flr,
       (SELECT *
          FROM pn_locations_all flat
         WHERE SYSDATE BETWEEN flat.active_start_date AND flat.active_end_date) flt,
       pn_properties_all prop,
       hz_parties hz,
       apps.hz_cust_accounts sc1
 WHERE     la.lease_id = pn.lease_id
       AND pn.location_id = flt.location_id
       AND flt.parent_location_id = flr.location_id
       AND flr.parent_location_id = bld.location_id
       AND bld.property_id = prop.property_id
       AND pn.customer_id = sc1.cust_account_id
       AND sc1.party_id = hz.party_id
       AND la.type_of_booking = 50

我不知道错误是什么。

我正在使用ORACLE

1 个答案:

答案 0 :(得分:1)

这部分错了:

prop.property_id = '1', bld.location_id building_id = '1309'

您似乎需要删除它并添加一些WHERE条件:

SELECT pn.lease_num,
       hz.party_name,
       flt.location_code,
       flt.office flat_no,
       NULL action,
       la.no_of_days,
       NULL remarks,
       flt.location_id flat_id,
       pn.lease_id
  FROM xxcus.xxacl_pn_leases_all la,
       pn_leases_all pn,
       (SELECT *
          FROM pn_locations_all flat
         WHERE SYSDATE BETWEEN flat.active_start_date AND flat.active_end_date) bld,
       (SELECT *
          FROM pn_locations_all flat
         WHERE SYSDATE BETWEEN flat.active_start_date AND flat.active_end_date) flr,
       (SELECT *
          FROM pn_locations_all flat
         WHERE SYSDATE BETWEEN flat.active_start_date AND flat.active_end_date) flt,
       pn_properties_all prop,
       hz_parties hz,
       apps.hz_cust_accounts sc1
 WHERE     la.lease_id = pn.lease_id
       AND pn.location_id = flt.location_id
       AND flt.parent_location_id = flr.location_id
       AND flr.parent_location_id = bld.location_id
       AND bld.property_id = prop.property_id
       AND pn.customer_id = sc1.cust_account_id
       AND sc1.party_id = hz.party_id
       AND la.type_of_booking = 50
       AND prop.property_id = '1'
       AND bld.location_id = '1309'