如何在POINT中使用MySQL变量

时间:2014-02-12 06:01:59

标签: mysql

我正在尝试将MySQL变量与POINT一起使用(简化):

SET @lat=145.033667; SET @long=-37.932000; INSERT INTO Location(position) values (GeomFromText(‘POINT(@lat @long)'));

这很好用:

SELECT 'POINT(145.033667 -37.932000)';

就像这样:

SELECT GeomFromText('POINT(145.033667 -37.932000)');

有没有人知道如何才能使这项工作?

1 个答案:

答案 0 :(得分:0)

我认为你有语法错误:

SET @lat=145.033667; 
SET @long=-37.932000; 
INSERT INTO Location(position) 
values (GeomFromText('POINT(@lat @long)'));  
                    ^^^ Here you need '