0
這是MySQL 5.x存儲過程的正確語法嗎?正確的語法爲MySQL 5存儲過程?
DELIMITER $$
CREATE PROCEDURE GetNearbyPhotogsByMapCenter(
lat1 decimal (7,3),
long1 decimal (7,3),
range numeric (15)
)
BEGIN
DECLARE rangeFactor decimal (7,6);
SET rangeFactor = 0.014457;
select * from (
SELECT B.cb_plug_lat, B.cb_plug_lng, B.cb_photostudio , B.city, B.State,
B.country, B.website, B.cb_basesserved, B.phone,
B.cb_isrc,B.cb_isavailableforsessions
FROM jos_comprofiler AS B, jos_users as JU
WHERE
B.cb_plug_lat BETWEEN lat1-(range*rangeFactor) AND
lat1+(range*rangeFactor)
AND B.cb_plug_lng BETWEEN long1-(range*rangeFactor) AND
long1+(range*rangeFactor)
AND GetDistance(lat1,long1,B.cb_plug_lat,B.cb_plug_lng) <= range
AND B.approved = 1
AND B.confirmed = 1
AND B.user_id = JU.id
ORDER BY B.cb_isrc desc) as D
WHERE D.cb_isavailableforsessions = 'Yes' or D.cb_isavailableforsessions is null;
END
$$
我想這個存儲過程加載到使用我的phpMyAdmin的SQL選項卡,我的MySQL數據庫。我沒有設置分隔符在該選項卡底部的$$按照這個帖子: How do I write an SP in phpMyAdmin (MySQL)?
所以我只是好奇,爲什麼我不斷收到此錯誤:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'lat1 decimal (7,3), long1 decimal (7,3), range numeric (15) BEGIN ' at line 2
實際上應該更新後的版本...這樣做,仍然同樣的錯誤。 – Codejoy 2011-01-20 22:45:20