Jan 14
Marc Pinnell [OT] Problem with Stored Procedure via Navicat
Jan 14, 2013; 09:34
Marc Pinnell
[OT] Problem with Stored Procedure via Navicat
Trying to create my very first Stored Procedure (sorry, late bloomer!), but I am getting and error that I can't track down when creating the procedure. Can anyone spot the problem?
The error:
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 '$$
DROP FUNCTION IF EXISTS `GetDistance`;
CREATE FUNCTION `GetDistance`(curlat' at line 7
The Script:
delimiter $$
DROP FUNCTION IF EXISTS `GetDistance`;
CREATE FUNCTION `GetDistance`(curlat VARCHAR(120), curlong VARCHAR(120), dblat VARCHAR(120), dblong VARCHAR(120))
RETURNS distance VARCHAR(120)
BEGIN
DECLARE lon1, lon2, lat1, lat2, distance DECIMAL(18,12);
select CAST(curlong) as DECIMAL(18,12)) into lon1;
select CAST(curlat) as DECIMAL(18,12)) into lat1;
select CAST(dblong) as DECIMAL(18,12)) into lon2;
select CAST(dblat) as DECIMAL(18,12)) into lat2;
select ((ACOS(SIN(lat1 * PI() / 180) * SIN(lat2 * PI() / 180) + COS(lat1 * PI() / 180) * COS(lat2 * PI() / 180) * COS((lon1 - lon2) * PI() / 180)) * 180 / PI()) * 60 * 1.1515) into distance;
RETURN distance;
END$$
delimiter ;
Marc Pinnell
1027 Design
PO Box 990872
Redding, CA 96099-0872
530.941.4706
fax: 866.232.5300
www.1027Design.com
#############################################################
This message is sent to you because you are subscribed to
the mailing list Lasso
Lasso@lists.lassosoft.com
To unsubscribe, E-mail to: <Lasso-unsubscribe@lists.lassosoft.com>
Send administrative queries to <Lasso-request@lists.lassosoft.com>
Jan 14
marc.vos Re: [OT] Problem with Stored Procedure via Navicat
Jan 14, 2013; 18:44
marc.vos
Re: [OT] Problem with Stored Procedure via Navicat
Jan 14
Adam de Zoete Re: [OT] Problem with Stored Procedure via Navicat
Jan 14, 2013; 17:51
Adam de Zoete
Re: [OT] Problem with Stored Procedure via Navicat
Jan 14
Marc Pinnell Re: [OT] Problem with Stored Procedure via Navicat
Jan 14, 2013; 10:50
Marc Pinnell
Re: [OT] Problem with Stored Procedure via Navicat
Jan 14
Marc Pinnell Re: [OT] Problem with Stored Procedure via Navicat
Jan 14, 2013; 10:50
Marc Pinnell
Re: [OT] Problem with Stored Procedure via Navicat
Jan 14
Adam de Zoete Re: [OT] Problem with Stored Procedure via Navicat
Jan 14, 2013; 18:54
Adam de Zoete
Re: [OT] Problem with Stored Procedure via Navicat
Jan 14
Marc Pinnell Re: [OT] Problem with Stored Procedure via Navicat
Jan 14, 2013; 11:04
Marc Pinnell
Re: [OT] Problem with Stored Procedure via Navicat
Jan 14
Marc Pinnell Re: [OT] Problem with Stored Procedure via Navicat
Jan 14, 2013; 11:13
Marc Pinnell
Re: [OT] Problem with Stored Procedure via Navicat
Jan 14
Marc Pinnell Re: [OT] Problem with Stored Procedure via Navicat
Jan 14, 2013; 11:22
Marc Pinnell
Re: [OT] Problem with Stored Procedure via Navicat