bind variables from java code
Date: 23 May 2003 02:26:09 -0700
Message-ID: <11f54ca0.0305230126.1a9caf51_at_posting.google.com>
Hi to all.
FIRST approach
SECOND approach
I want to make you a qustion:
I know two way to call a stored procedure from a piece of java code,
with very few differences.
Both of them use a CallableStatement, but the first bind the input
parameters directly in the String passed to the prepareCall method,
while the latter provides to the prepareCall method only quotation
mark as stored procedure parameters and the binds the input parameters
with the set methods of the CallableStatement. An exemple will clarify
the two approaches:
.....
CallableStatement cstmt;
String storedProcCall = "{ CALL SC_FILL_PRESENCE(?, ?, ?, ?) };
cstmt = dbConn.prepareCall(storedProcCall);
// Binding input varialbes
cstmt.setString(1, v_udptype);
cstmt.setString(2, v_ip);
//Registering SP out parameters
cstmt.registerOutParameter(3, java.sql.Types.INTEGER);
cstmt.registerOutParameter(4, java.sql.Types.VARCHAR);
.....
.....
CallableStatement cstmt;
//input parameters already binded inside the String
String storedProcCall = "{ CALL SC_FILL_PRESENCE(v_udptype, v_ip, ?,
cstmt = dbConn.prepareCall(storedProcCall);
//Registering SP out parameters
cstmt.registerOutParameter(1, java.sql.Types.INTEGER);
cstmt.registerOutParameter(2, java.sql.Types.VARCHAR);
.....
What's the differences on Oracle side? It opens more cursors parsing the String with already the input parameters in there? And if it's true, why?
Thanks in advance Received on Fri May 23 2003 - 11:26:09 CEST