FunctionMultiReturn

User defined functions can return a result set, and can therefore be used like a table. This sample application uses such a function to convert polar to cartesian coordinates.

Methods
static void main(String... args)
This method is called when executing this sample application from the command line.
static void main(String... args) throws Exception
This method is called when executing this sample application from the command line.
Parameters:
args - the command line parameters
static ResultSet polar2Cartesian(Double r, Double alpha)
Convert polar coordinates to cartesian coordinates.
static ResultSet polar2Cartesian(Double r, Double alpha)
Convert polar coordinates to cartesian coordinates. The function may be called twice, once to retrieve the result columns (with null parameters), and the second time to return the data.
Parameters:
r - the distance from the point 0/0
alpha - the angle
Returns:
a result set with two columns: x and y
static Object[] polar2CartesianArray(Double r, Double alpha)
Convert polar coordinates to cartesian coordinates.
static Object[] polar2CartesianArray(Double r, Double alpha)
Convert polar coordinates to cartesian coordinates. The function may be called twice, once to retrieve the result columns (with null parameters), and the second time to return the data.
Parameters:
r - the distance from the point 0/0
alpha - the angle
Returns:
an array two values: x and y
static ResultSet polar2CartesianSet(Connection conn, String query)
Convert a set of polar coordinates to cartesian coordinates.
static ResultSet polar2CartesianSet(Connection conn, String query) throws SQLException
Convert a set of polar coordinates to cartesian coordinates. The function may be called twice, once to retrieve the result columns (with null parameters), and the second time to return the data.
Parameters:
conn - the connection
query - the query
Returns:
a result set with the coordinates