Forums Register Login

Callable statement without binding

+Pie Number of slices to send: Send
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.
If you open the box, you will find Heisenberg strangling Shrodenger's cat. And waving this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 811 times.
Similar Threads
A comment inside a CallableStatement messes with parameters
connection pooling issue in production environment -
Callable Statement problem
Problem calling IN parameters Stored Procedure from Java
Malformed SQL92 - Please Help.
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 02:46:22.