oracle一直拒绝我在try子句中尝试调用经度的任何东西。
WITH params as (
SELECT -28 as lat, 151 as lon
FROM dual
)
SELECT sighting_id
FROM sightings
ORDER BY sqrt(power(lat - latitude, 2) + power(lon - longitude, 2));
答案 0 :(得分:2)
您可以在WITH中定义参数,但不要在FROM中引用它。
WITH params as (
SELECT -28 as lat, 151 as lon
FROM dual
)
SELECT sighting_id
FROM sightings CROSS JOIN params
ORDER BY sqrt(power(lat - latitude, 2) + power(lon - longitude, 2));