Why do we use prepared statement when already statement is present

Showing Answers 1 - 5 of 5 Answers

Jayakar

  • Oct 14th, 2005
 

Prepared statement is a precompiled statement, it is mailnly used for the speed up the prcoss of inserting/updating/deleting when there is a bulk processing.

 

Jayakar

  • Oct 14th, 2005
 

Prepared statement is a precompiled statement, it is mailnly used for the speed up the prcoss of inserting/updating/deleting when there is a bulk processing.

 

  Was this answer useful?  Yes

mamatha03

  • Oct 24th, 2005
 

Actually when u submit a simple statement to the databse, at first the DBMS parses it and sends it back with the result, so again when u send the same statement again the DBMS server parses it and sends back the result so here a lot of time is wasted and because the statement is again parsed though it has been sent twice or thrice it consumes a lot of time and response will be slow.Prepared Statement is used when u want to execute a statement object many times. when u submit a PreparedStatement the DBMS server parses it and creates a execution plan. This e-plan can be used when u again send the same statement to the database.That is the DBMS server zest executes the compiled statement rather that executing it from first, hence we get an precompiled statement.And also the advanatge of using this PreparedStatement is it is used to send dynamic sql statements, which u can give values later than giving the values at the time of creation.

  Was this answer useful?  Yes

Anurjay Pradhan

  • Nov 22nd, 2005
 

Prepared Statement is Pre-compiled class , but Statement is not.

So in PreparedStatement the execution will be faster.

  Was this answer useful?  Yes

Naim Kazi

  • Feb 14th, 2006
 

But guys prepared statement has one disadvantage that it holds the data in the database. So when you execute a prepared statement for the first time, it will save the data in the database so that for the next time it does not take time for execution.

So if you are executing a prepared statement for a query "select * from employee", this will take a lot of space in the database, as it always has to store this data for the prepared statement.

So if you are executing a prepared statement then you should only use when it is really needed and for the queries which do not return many rows.

  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