What is the difference between a CallableStatement and PreparedStatement?

Showing Answers 1 - 32 of 32 Answers

Lavanya

  • Dec 29th, 2005
 

Callable Statement is used to call stored procedures  while coming to the Prepared Statement is used to input to the tables dynamically.

Abhishek Parikh

  • Dec 30th, 2005
 

Callable statement are used to call the stored proedures.

While Prepared statment are used for the SQL Query statments.

Chintan Sanghavi

  • Dec 30th, 2005
 

Callable statement is used for calling stored procedure/functions but prepared statement is used for calling sql statements.

  Was this answer useful?  Yes

arunsivaram

  • Dec 30th, 2005
 

Callable statement is that which can be called anywhere in the program.

Eg:- getText()

Prepared statement is that which is coded with a certain procedure and execute when the program gets executed.

  Was this answer useful?  Yes

Jawad Hussain

  • Jan 18th, 2006
 

Prepared Statement is used to pass run time parameters, whereas callable statements is used to call stored procedures.

  Was this answer useful?  Yes

Sri

  • Jan 23rd, 2006
 

prepared statement is compiled only once and executed many times with different parameters avoiding delay of compilation for every retrival (execution).In prepared statements the date formats and number formats are taken care of. Also it takes care if we have a string with apostrophe,which otherwise needs to be escaped everytime.

Callable statement is used for SQL statements already built inside database (PL/SQL procedures etc.) which are permanently precompiled in database.

abhinandan

  • Feb 3rd, 2006
 

CallableStatement is used to StoredProcedures and functions while Prepared statment is used to execute the SQL query.

  Was this answer useful?  Yes

Prepare Statement are not pre compiled . They are only compiled once. Prepare statement can be used when same query is excuted multiplie times with different parameters

  Was this answer useful?  Yes

srinivas.bora

  • Mar 21st, 2006
 

Statement: to be used createStatement() method for executing single SQL statement PreparedStatement

  Was this answer useful?  Yes

prasad

  • Mar 23rd, 2006
 

Statement is used to execute single queries only once.prepared statement is used to execute single sql queries again and again, where as callable statement is used to execute any number of sql queries

  Was this answer useful?  Yes

Senthil N

  • Apr 20th, 2006
 

Both Prepared and Callable statements are precompiled.

PreparedStatement
-----------------
1.Used for Batch process.(Please verify addBatch(),executeBatch() methods)
2.Control the transactions.(AutoCommit,SavePoint etc..)
3.Traverse the ResultSet and CRUD(CREATE,READ,UPDATE,DELETE) operations can be done.

CallableStatement
-----------------
Called the Procedure.


Thanks
Senthil

  Was this answer useful?  Yes

parimmallarekha

  • Jun 24th, 2006
 

Callable statement is used to execute stored procedures

Prepared statement is used to pass the parameters to the database

  Was this answer useful?  Yes

mc.thiru

  • Jun 24th, 2010
 

PreparedStatement:
Use when you plan to use the SQL statements many times. The PreparedStatement interface accepts input parameters at runtime

CallableStatement:
Use when you want to access database stored procedures. The CallableStatement interface can also accept runtime input parameters.

  Was this answer useful?  Yes

Vasanth

  • Mar 27th, 2012
 

Prepared statements can also execute a sql block or stored procedure.

But advantage of callable statement is it has registerOutParameter option.

If you want the OUT param value, you need to use CallableStatement alone.

  Was this answer useful?  Yes

Anang Desai

  • Aug 13th, 2014
 

First of all let me tell about Statement (Interface) this interface is used to execute the SQL query in the programme, Prepare Satement(Interface) Extends Statement Interface and it is also used to Execute SQL query(Pre-Compiled) and another Diff between (Statement & Prepare Statement ) is the Prepare Statement Pass the value Run time NOT Compile time also callable Statement interface Extends Prepare Statement and it is used to call the Store Procedure in SQL and these Store procedure are called by callable interface in java using(IN,OUT,or IN OUT) Parameter...

  Was this answer useful?  Yes

pratima

  • Oct 15th, 2014
 

prepared statement:Use when you plan to use the SQL statements many times. The Prepared Statement interface accepts input parameters at run time.

CallableStatement:Use when you want to access database stored procedures. The Callable Statement interface can also accept run time input parameters.

  Was this answer useful?  Yes

satyendra kumar

  • Dec 2nd, 2014
 

prepared statement available in java.sql package and its extends statement but callable statement is available in java.sql package and its extends prepared statement ....

  Was this answer useful?  Yes

kalyankarri

  • Dec 27th, 2014
 

callable stmt is used to call stored procedure,prepared stmts executes sql queries.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions