Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#280 Suppport output parameter in CallableStatement for functions

open
nobody
jdbc (33)
5
2014-04-02
2012-05-30
Pollerboy
No

Calling SQL functions using CallableStatement with registerOutParameter(...) produces the following error:
Invalid argument in JDBC call: Not OUT or INOUT mode: 1 for parameter: 1

See also: https://sourceforge.net/projects/hsqldb/forums/forum/73673/topic/3363850

Steps to reproduce:
1. Define function:
CREATE FUNCTION duplicate(IN num INTEGER)
RETURNS INTEGER
RETURN num * 2;
;

2. Call function
CallableStatement cs = connection.prepareCall("{ ? = call duplicate(?) }");
cs.registerOutParameter(1, Types.INTEGER, 0);
cs.setInt(2, 5);

cs.execute();

Discussion

  • Fred Toussi
    Fred Toussi
    2012-08-06

    Currently an HSQLDB FUNCTION cannot have out parameters. It can return a single value result or table, which is returned by the execute() call.

     
  • So, how would one go about calling a stored function using a CallableStatement?