嗨,我需要从我的 Oracle 表中获取几何坐标。目前我使用
(select column_value
from (
select rownum r,
b.*
from table(
select h.geometry.sdo_ordinates
from hz_locations h
where location_id =
(select location_id
from csf_ct_tasks
where task_id = p_task_id)
) b
) -- location_id = 973, task_id = 36420
where r =1) as latitude,
(select column_value
from (
select rownum r,
b.*
from table(
select h.geometry.sdo_ordinates
from hz_locations h
where location_id =
(select location_id
from csf_ct_tasks
where task_id = p_task_id)
) b
)
where r =2) as longitude
这里p_task_id
是用来获取特定纬度、经度的一个任务。但我需要通过在外部查询中指定用户 ID 来获取单个用户的纬度、经度列表。是否可以重写我的查询。
我的实际选择语句是
SELECT all h.location_id,
h.address1,
h.address2,
h.address3,
h.address4,
h.house_number,
h.street_suffix,
h.apartment_number,
h.street,
h.po_box_number,
h.city,
h.state,
h.province,
h.county,
h.country,
h.postal_code as customer_address
from hz_locations h,
csf_ct_tasks ct
where h.location_id = ct.location_id
and ct.owner_id = 10180
提前致谢。
![表格中经纬度存储的示例响应][2]