Menu

#280 Suppport output parameter in CallableStatement for functions

open
nobody
jdbc (34)
5
2014-08-15
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

  • Pollerboy

    Pollerboy - 2012-05-30

    Maven project with failing unit test

     
  • 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.

     
  • Quinton McCombs

    Quinton McCombs - 2014-04-02

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

     

Log in to post a comment.