我不断错过表达错误,但我看不出我做错了什么?
DECLARE
lat NUMBER := -28;
lon NUMBER := 151;
BEGIN
SELECT
sighting_id
FROM
sightings
ORDER BY
sqrt(power(lat - latitude, 2) + power(lon - longitude, 2))
END;
答案 0 :(得分:2)
您的查询中有多处错误。
from
之前的逗号。long
,这是一个保留字(请参阅here)。limit
(Oracle不支持)。DESC
关键字应该在关键表达式之后,而不是之前。对于距离,通常使用ASC
,而不是DESC
。INTO
子句或其他放置结果的地方。您确定要使用Oracle吗?
编辑:
从看起来更像这样的查询开始:
WITH params as (
SELECT -28 as lat, 151 as lon
FROM dual
)
SELECT s.sighting_id
FROM params CROSS JOIN
sightings s
ORDER BY sqrt(power(lat - latitude, 2) + power(lon - longitude, 2))
FETCH FIRST 1 ROW ONLY; -- Note: this is in Oracle 12c+
答案 1 :(得分:0)
黑客等级解决方案:
.page2{
width: 100%;
margin: 0 auto;
margin-top: 20px;
height: 100%;
}
//cards
.wrap{
width:960px;
margin:auto;
margin-top: 100px;
}
.card{
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.15);
transition: 0.4s;
width: 300px;
text-align: center;
font-size: 16px;
float:left;
margin:10px;
text-decoration: none;
}
.page3{
margin: 20px;
margin-top: 20px;
height: 30%;
}
.umbrella_icon {
text-align: center;
}
.footer {
z-index: 1000;
width: 960px;
margin: 0 auto;
}