Subject | Re: CallableStatement returning same number |
---|---|
Author | rrokytskyy |
Post date | 2002-02-04T16:13:12Z |
> for (int i=0; i<100; i++) {PROCEDURE
> //DOESN'T SEEM TO WORK CallableStatement cs =
> con.getCallableStatement("{CALL SP_TMPOBJ_INSERT()}");
> CallableStatement cs = con.getCallableStatement("EXECUTE
> SP_TMPOBJ_INSERT;");I will check this. Probably this is related to the issue that
> //cs.registerOutParameter(1, Types.NUMERIC); //UNSUPPORTED?
> cs.execute();
> long lID = cs.getLong(1);
> System.out.println(lID);
> }
{CALL ...} is translated to the EXECUTE PROCEDURE. And since I do not
know what parameters are out, there's no result.
registerOutParam is not implemented. The reason is that with current
implementation we have to jump over the head: FBCallableStatement is
subclass of the FBPreparedStatement, which is, in turn, prepared in
the constructor. The correct SQL must be constructed at the time
of "new FBCallableStatement(...)". But escaped syntax does not
provide the info about the IN, OUT and IN/OUT parameters. And
registerOutParam(...) is invoked on the object that already has a
prepared statement and has no effect on it (if we were lucky to get
to this point, because if the parameters specified in the callable
statement do not match the parameters specified in the procedure
definition, for example {call my_proc(?)}, and we had CREATE
PROCEDURE my_proc RETURNS bla INTEGER....).
Best regards,
Roman Rokytskyy