What is the difference between static and dynamic SQL?



What is the difference between static and dynamic SQL?..

Answer / jkb

In Stats SQL, the statement is prepared before the program
is executed and the operational form of the statement
persists beyond the execution of the program. A source
program containing static SQL statements must be processed
by an SQL precompiler before it is compiled. The
precompiler checks the syntax of the SQL statements, turns
them into host language comments, and generates host
language statements to invoke DB2.


A dynamic SQL statement is prepared during the execution of
an SQL application, and the operational form of the
statement is not persistent. The source form of the
statement is a character string passed to DB2 by an
application program using the static SQL statement PREPARE
or EXECUTE IMMEDIATE.

Is This Answer Correct ?    52 Yes 9 No

Post New Answer

More DB2 Interview Questions

What is cursor stability?

1 Answers  


Which component is responsible for db2 startup and shutdown?

1 Answers  


What is the significance of DB2 free space and what parameters control it?

1 Answers  


List some fields from sqlca?

1 Answers  


what happend with out using Commit,when closing cursor and program?

5 Answers   CSC,


Why cursor is used in db2?

1 Answers  


What is commit in db2?

1 Answers  


Under what circumstances will DB2 allow an SQL statement to update more than one primary key value at a time?

1 Answers  


What's The Error Code For Unique Index Voilation?

1 Answers   IBM,


what is the soft code for deadlock ?

2 Answers   Logica CMG,


Consider that a package is bound into 2 different collections and the PKLIST option specifies both the collections. If the collection id is not specified in the program while executing the SQL query, then when the DB2 system will search the package list, which collection will it pick up or will it give an error/abend?

1 Answers  


What is explain plan in db2?

1 Answers  


Categories