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