Explain how can you do the explain of a dynamic sql statement?



Explain how can you do the explain of a dynamic sql statement?..

Answer / Prince Gupta

In DB2, you cannot directly use EXPLAIN on a dynamic SQL statement. However, you can create an explanation plan for each component of the dynamic SQL and then combine them manually. Here's an example:n
1. Create a prepared statement for each subquery:n```sqlnPREPARE stmt1 AS SELECT column_name FROM table_name WHERE condition1;```n
2. Explain the prepared statement:n```sqlnexplain PLAN FOR stmt1;```n
3. Repeat steps 1 and 2 for all subqueries.n
4. Finally, combine the explanation plans manually.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More DB2 Interview Questions

What is a DBRM, PLAN ?

3 Answers  


What is bind package and plan in db2?

1 Answers  


What are the isolation levels possible ?

3 Answers  


How to insert more than one record using insert?

7 Answers   Atos Origin, IBM,


What is ACQUIRE/RELEASE in BIND?

3 Answers   Cognizant,


How to access db2 tables in mainframe?

1 Answers  


what is datacom db?

2 Answers   CSC,


What is dbrm? What it contains? When it will be created?

1 Answers  


Can you define an Index if the table size less than 10 PAGES?

1 Answers   IBM,


What does the sqlcode of -818 pertain to?

3 Answers  


Mention data types used in db2 ?

1 Answers  


What is DCLGEN ?

3 Answers  


Categories