![]() | |
#11
| |||
| |||
|
|
Charles <ccha... (AT) gmail (DOT) com> wrote: On Oct 12, 12:09=A0am, Axel Schwenke <axel.schwe... (AT) gmx (DOT) de> wrote: http://dev.mysql.com/doc/refman/5.1/...-routines.html Neither way you can execute any Java code in the MySQL server. But how complicated can that "formula" be, that you can't express it in SQL? Quite. http://www.movable-type.co.uk/script...-vincenty.html 1. this is not complicated 2. this can be expressed in PL/SQL 3. this is rather senseless IMHO What I'm looking for is *coding so that I can: SELECT * FROM table1 WHERE column9 = function(COL5, COL6, COL7, COL8) 4. comparing floating point numbers for equality is foolish Looks like a perfect fit for a stored function. RTFM! XL |
#12
| |||
| |||
|
|
On Oct 12, 7:37Â*am, Sherm Pendley <sherm.pend... (AT) gmail (DOT) com> wrote: Charles <ccha... (AT) gmail (DOT) com> writes: On Oct 12, 12:09Â*am, Axel Schwenke <axel.schwe... (AT) gmx (DOT) de> wrote: But how complicated can that "formula" be, that you can't express it in SQL? Quite. http://www.movable-type.co.uk/script...-vincenty.html You're kidding, right? That's just a loop and a few calls to built-in trig functions. It's well within the capabilities of an SQL procedure. Which was the original purpose of the question - to make sure it can be done and maybe a hint or suggestion as to direction in which to find it. |
#13
| |||
| |||
|
|
The function I want to implement takes the GPS latitude/longtitude and computes the distance between them. What I'm looking for is coding so that I can: SELECT * FROM table1 WHERE column9 = function(COL5, COL6, COL7, COL8) and possible pass two constants as parameters so that I don't have this problem again. |
#14
| |||
| |||
|
|
The function I want to implement takes the GPS latitude/longtitude and computes the distance between them. What I'm looking for is *coding so that I can: SELECT * FROM table1 WHERE column9 = function(COL5, COL6, COL7, COL8) and possible pass two constants as parameters so that I don't have this problem again. As others have pointed out, an equality is hardly possible with floating-point numbers. But I assume you are looking for points within a range or something. It may sound like premature optimization, but if your table is of any serious size, this query can be very slow. It needs a table scan over the entire table. If there is any less computationally expensive way of estimating the result, it could help to store intermediate results or to add an extra constraint in the WHERE clause if it can use an index to reduce the number of rows scanned by the heavy function. |
#15
| |||
| |||
|
|
The function I want to implement takes the GPS latitude/longtitude and computes the distance between them. What I'm looking for is *coding so that I can: SELECT * FROM table1 WHERE column9 = function(COL5, COL6, COL7, COL8) and possible pass two constants as parameters so that I don't have this problem again. As others have pointed out, an equality is hardly possible with floating-point numbers. But I assume you are looking for points within a range or something. It may sound like premature optimization, but if your table is of any serious size, this query can be very slow. It needs a table scan over the entire table. If there is any less computationally expensive way of estimating the result, it could help to store intermediate results or to add an extra constraint in the WHERE clause if it can use an index to reduce the number of rows scanned by the heavy function. |
![]() |
| Thread Tools | |
| Display Modes | |
| |