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

How to access db2 tables in mainframe?

0 Answers  


What is the use of runstats in db2?

0 Answers  


How many Buffer pools are there in DB2 and what are they?

1 Answers   IBM,


Mention the way of highlighting as well as putting a cursor to use in a cobol program.

0 Answers  


we can code COPY DCLGEN or INCLUDE DCLGEN, At which stage of the precompilation , dclgen get expanded if we write 1) copy 2) include one question about dclgen.. Is it mandatory to use declare table in dclgen.. I think no...but it will be used by the precompiler to validate the table name,column name etc.., can one clear my doubt ..is it necessary to include declare table or not?

2 Answers  






What do you mean by NOT NULL WITH DEFAULT? When will you use it?

3 Answers  


What is db2 instance?

0 Answers  


what is commit & rollback? When and where is used while compiling a cobol-db2 program?

2 Answers  


Where do you specify them?

0 Answers  


How to update more then one record using update?

5 Answers   IBM,


what are the frequent DB2 abends did you encounter in your programs ?? What are different SQL abends ??

4 Answers   Xansa,


What is the syntax of SELECT statement when embedded in a COBOL program?

2 Answers  


Categories