what r callable statement and give their proper use
Answer Posted / prajal
Callable statement (java.sql.CallableStatement) are used for
calling a Stored Procedure.
Syntax is as below-
//prepare a procedure call
String procedureCall="call testProcedure(:1,:2,:3)";
//prepare a callable statement
CallableStatement
cStmt=connectionObject.prepareCall(procedureCall);
// Set the Input Parameters to the procedure
cStmt.setInt(1, testID);
cStmt.setInt(2, testNumber);
// Register Output Parameters
cStmt.registerOutParameter(3, Types.VARCHAR);
// Execute the Callable Statement
cStmt.execute();
// Resulting Values from the Callable Statement is assigned
to the Message variable
String message = cStmt.getString(3);
| Is This Answer Correct ? | 5 Yes | 0 No |
Post New Answer View All Answers
What is difference overloading and overriding?
What is the difference between Grid and Gridbaglayout?
Similarity and difference between static block and static method ?
Objects or references which of them gets garbage collected?
What does exp mean in math?
Can a constructor be protected?
Is the empty set a singleton?
How do I get 64 bit java?
What is object-oriented paradigm?
What is the difference between reader/writer and inputstream/output stream?
do I need to use synchronized on setvalue(int)? : Java thread
How to create a custom exception?
What is the difference between a loader and a compiler?
What is externalizable interface?
Define how can we find the actual size of an object on the heap?