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


Please Help Members By Posting Answers For Below Questions

What is the purpose of lambda expressions?

584


What is the default value of local and global variables?

565


what is the difference between the methods sleep() and wait()? : Java thread

515


what do you understand by synchronization? : Java thread

548


What is the difference between comparison done by equals method and == operator?

571






What is an empirical question?

538


When does an object becomes eligible for garbage collection in java?

576


Are global variables initialized to zero?

511


What does this () mean in constructor chaining concept?

560


Explain the difference between an Interface and an Abstract class?

625


What is qms certification?

521


Why java does not support pointers?

560


Can you add null to a list java?

584


What is the use of generics? When was it added to the Java development Kit?

554


What is the same as procedures?

530