hemant kumar
What is the difference between static and dynamic SQL?
1 Answer(s)      6 years and 4 months ago
Posted in : SQL

What is the difference between static and dynamic SQL?


View Answers

November 18, 2010 at 1:24 PM


Static SQL is SQL statements in an application that do not change at runtime and, therefore, can be hard-coded into the application.Static SQL is usually targeted at a specific database and in many cases gets stored in stored procedures. Many applications (especially Enterprise Applications) reach a stage where some dynamic data manipulation is required and static SQL techniques no longer sufficient.

Dynamic SQL is SQL statements that are constructed at runtime. Dynamic SQL generation is also needed in applications where the databases structure itself is dynamic. Many Enterprise Applications allow users to customize the way data is stored and displayed.

for example, the application may allow users to enter their own queries. Thus, the SQL statements cannot be hard-coded into the application.

Static SQL provides performance advantages over dynamic SQL because static SQL is preprocessed, which means the statements are parsed, validated, and optimized only once.


Related Tutorials/Questions & Answers: