- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Explain the concept of DYNAMIC SQL in DB2 with the help of an example
A static SQL is hardcoded in COBOL-DB2 program and the SQL query cannot change during the program execution. We can only change the value of the host variables. In the case of DYNAMIC SQL, we can change the columns, tables and predicates in the COBOL-DB2 program in run time.
For example, based on the current date, we can update ORDERS or ORDERS_HIST table. This query can be built using DYNAMIC SQL which includes ORDERS table or ORDER_HIST table.
The main advantage of DYNAMIC SQL is its flexibility. We can add columns or change tables/predicates as per our business logic. On the other hand, the main disadvantage of DYNAMIC SQL is, they take more CPU and execution time as compared to STATIC SQL.
- Related Articles
- Explain the concept of LOCK PROMOTION with the help of an example
- What are COLUMN functions in DB2? Explain with the help of an example
- What is the use of the VALUE function in a DB2? Explain with the help of an example
- What is CLUSTERED INDEX in DB2? Explain with the help of practical example.
- What is the difference between DB2 JOIN and UNION? Explain with the help of an example
- What is NON CLUSTERED INDEX in DB2? Explain with the help of practical example
- Explain the concept of primary key with an example (DBMS)?
- Explain the concept of key attributes with an example in DBMS?
- Explain the concept of integrity in DB2 along with types of integrity
- Explain join operations with the help of an example in DBMS
- Explain aggregate functions with the help of SQL queries
- What is symbiotic relationship? Explain with the help of an example
- What is the purpose of COALESCE function? Explain with the help of an example.
- Explain dynamic memory allocation in C with an example
- Explain SHARED, UPDATE and EXCLUSIVE locks with the help of an example

Advertisements