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
Which collection is thread safe in java?
What is method in java with example?
Why are global variables used?
What is an object class?
What is the use of toarray () in java?
What are constants and how to create constants in java?
What are keyboard events?
What is the use of hashmap in java?
What is data string?
What is the full name of java?
Which containers use a flowlayout as their default layout in java programming?
What is the static method?
List any five features of java?
How can you share data between two thread in Java?
Can you create an object of an abstract class?