![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Is it possible in SQL to develop a subroutine in some way? I've got a Java function (formula) I'd like to implement into a Select query to compute a column, but (If I'm reading the manual correctly) I'd rather not have to recompile the entire database and redevelop the entire application to get a single formula included. This will be implemented in a PHP environment and web accessible, Anyone have any possible ideas? |
#3
| |||
| |||
|
|
Is it possible in SQL to develop a subroutine in some way? I've got a Java function (formula) I'd like to implement into a Select query to compute a column, but (If I'm reading the manual correctly) I'd rather not have to recompile the entire database and redevelop the entire application to get a single formula included. This will be implemented in a PHP environment and web accessible, Anyone have any possible ideas? http://dev.mysql.com/doc/refman/5.5/...functions.html |
#4
| |||
| |||
|
|
Is it possible in SQL to develop a subroutine in some way? |
|
I've got a Java function (formula) I'd like to implement into a Select query to compute a column |
#5
| |||
| |||
|
|
Is it possible in SQL to develop a subroutine in some way? I've got a Java function (formula) I'd like to implement into a Select query to compute a column, but (If I'm reading the manual correctly) I'd rather not have to recompile the entire database and redevelop the entire application to get a single formula included. This will be implemented in a PHP environment and web accessible, Anyone have any possible ideas? |
#6
| |||
| |||
|
|
Charles <ccha... (AT) gmail (DOT) com> wrote: Is it possible in SQL to develop a subroutine in some way? MySQL 5.0 and later supports stored routines (functions and procedures). Those are written in some PL/SQL derivative. Looks like you already found user defined functions (UDF) which are written in C/C++ and typically compiled to a shared library and loaded at runtime. Stored routines are much easier to use! http://dev.mysql.com/doc/refman/5.1/...-routines.html I've got a Java function (formula) I'd like to implement into a Select query to compute a column 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? XL |
#7
| |||
| |||
|
|
On 11/10/10 20:06, Charles wrote: Is it possible in SQL to develop a subroutine in some way? I've got a Java function (formula) I'd like to implement into a Select query to compute a column, but (If I'm reading the manual correctly) I'd rather not have to recompile the entire database and redevelop the entire application to get a single formula included. This will be implemented in a PHP environment and web accessible, Anyone have any possible ideas? I do not see exactly what you want. If you really want to run it on the database server, there are a few options. In addition to the already given suggestions, you can use prepared statements if the formula varies. But if you just have a program that reads data from a database and processes it, I would say that you would best apply your function after reading in the query results, in the program and not in the query on the database server. Good luck, -- Willem Bogaerts Application smith Kratz B.V.http://www.kratz.nl/ |
#8
| |||
| |||
|
|
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 |
|
What I'm looking for is coding so that I can: SELECT * FROM table1 WHERE column9 = function(COL5, COL6, COL7, COL8) |
#9
| |||
| |||
|
|
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 |
#10
| |||
| |||
|
|
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. sherm-- -- Sherm Pendley * * * * * * * * * * * * * * * * * *<http://camelbones.sourceforge.net Cocoa Developer |
![]() |
| Thread Tools | |
| Display Modes | |
| |