What do u mean by precompiled statement? What is the difference between Statement and PreparedStatement?

This question is related to Oracle Interview

Showing Answers 1 - 6 of 6 Answers

Sandhya14

  • Apr 4th, 2008
 

A PreparedStatement is precompiled statement.
It means PreparedStatement compiles the SQL Statement in the first run itself. Thus, if the Statement is preparedStatement, you can run the Statement multiple times without having to compile it again and again. 
PreparedStatement "compiles" & runs the SQL Statement on the first run, & simply executes ( without compiling ) - it saves a lot of time.

It simply means that whenver you use a Statement, the SQL Statement is going to be  compiled and the execute but by using preparedStatement there is no need of compilation again and again, so it is faster than statement


  Was this answer useful?  Yes

Akib Jabed

  • Oct 31st, 2022
 

Since the query is passed at the time of implementation object creation of the preparedStatement net interface but not in the execute() method.
Hence, preparedStatement are also known as precompiled Statements.

  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