Subject | Syntax in calling stored procedure |
---|---|
Author | vmdd_tech |
Post date | 2004-03-12T15:38:12Z |
I have a stored procedure init_test which returns an integer.
If I call it as:
stmt.execute ("{call init_test()}");
Then it works, and then I can get the result by calling
stmt.getResultSet ().
However, if I call the procedure like:
stmt.execute ("{call init_test ()}"); //Notice a space before ()
Then the program will throw an exception:
java.lang.StringIndexOutOfBoundsException: String index out of range:
0
at java.lang.StringBuffer.charAt(StringBuffer.java:274)
at org.firebirdsql.jdbc.FBEscapedCallParser.parseCall
(FBEscapedCallParser.java:340)
at org.firebirdsql.jdbc.FBEscapedParser.convertProcedureCall
(FBEscapedParser.java:344)
at org.firebirdsql.jdbc.FBEscapedParser.escapeToNative
(FBEscapedParser.java:266)
at org.firebirdsql.jdbc.FBEscapedParser.parse
(FBEscapedParser.java:210)
at org.firebirdsql.jdbc.AbstractConnection.nativeSQL
(AbstractConnection.java:258)
at
org.firebirdsql.jdbc.AbstractStatement.prepareFixedStatement(Abstract
Statement.java:1013)
at org.firebirdsql.jdbc.AbstractStatement.internalExecute
(AbstractStatement.java:1000)
at org.firebirdsql.jdbc.AbstractStatement.execute
(AbstractStatement.java:497)
So, did I use the wrong syntax or was it a driver bug?
Ben
If I call it as:
stmt.execute ("{call init_test()}");
Then it works, and then I can get the result by calling
stmt.getResultSet ().
However, if I call the procedure like:
stmt.execute ("{call init_test ()}"); //Notice a space before ()
Then the program will throw an exception:
java.lang.StringIndexOutOfBoundsException: String index out of range:
0
at java.lang.StringBuffer.charAt(StringBuffer.java:274)
at org.firebirdsql.jdbc.FBEscapedCallParser.parseCall
(FBEscapedCallParser.java:340)
at org.firebirdsql.jdbc.FBEscapedParser.convertProcedureCall
(FBEscapedParser.java:344)
at org.firebirdsql.jdbc.FBEscapedParser.escapeToNative
(FBEscapedParser.java:266)
at org.firebirdsql.jdbc.FBEscapedParser.parse
(FBEscapedParser.java:210)
at org.firebirdsql.jdbc.AbstractConnection.nativeSQL
(AbstractConnection.java:258)
at
org.firebirdsql.jdbc.AbstractStatement.prepareFixedStatement(Abstract
Statement.java:1013)
at org.firebirdsql.jdbc.AbstractStatement.internalExecute
(AbstractStatement.java:1000)
at org.firebirdsql.jdbc.AbstractStatement.execute
(AbstractStatement.java:497)
So, did I use the wrong syntax or was it a driver bug?
Ben