我想在我的下面的oracle查询中添加rownum
,但它给出了我的错误
ORA-30484:缺少此功能的窗口规范
这是我的查询
SELECT ROW_NUMBER () AS sr_no, 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'
请帮助解决错误
我正在使用ORACLE
答案 0 :(得分:3)
请参阅ROW_NUMBER的文档。你需要写一些类似的东西:
SELECT ROW_NUMBER() OVER (PARTITION BY la.type_of_booking ORDER BY la.lease_id)
FROM xxcus.xxacl_pn_leases_all la
或
SELECT ROW_NUMBER() OVER (ORDER BY la.lease_id)
FROM xxcus.xxacl_pn_leases_all la