Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Callable statement without binding

 
Rich Sawyer
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I handle nulls without binding parameters in a callable statement?
For example the following are equivalent:
sql = "{CALL SCHEMA.STOREDPROCEDURE(?, ?)}";
CallableStatement call = connection.prepareCall(sql);
call.setInt(1, 1);
call.setString(2, "C");
sql = "{CALL SCHEMA.STOREDPROCEDURE(1, 'C')}";
CallableStatement call = connection.prepareCall(sql);
How are nulls implemented? In the first statement, i would just use:
call.setNull(1, java.sql.Types.INTEGER);
But inline "null" does not work (either does "Null" or "NULL"):
sql = "{CALL SCHEMA.STOREDPROCEDURE(null, 'C')}";
What am I missing? By the way, am I going to encounter similiar problems with timestamps? Everyone is using binding so resources are rare.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic