- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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
What is Fixed-list SELECT? Give the syntax and explain with help of an example
The EXECUTE IMMEDIATE and EXECUTE with PREPARE could not be used for SELECT query. For the SELECT query, we have a fixed list SELECT in which the column to be fetched remains fixed and it cannot be changed.
For example, if we want to select the orders placed on 14-08-2020. Then we can use dynamic SQL as given below:
Example
MOVE ‘SELECT ORDER_ID FROM ORDERS WHERE ORDER_DATE=?’ TO WS-SQL-QUERY EXEC SQL DECLARE ORDER-CUR CURSOR FOR SELQUERY END-EXEC EXEC SQL PREPARE SELQUERY FROM :WS-SQL-QUERY END-EXEC MOVE ‘14-08-2020’ TO WS-ORDER-DATE EXEC SQL OPEN ORDER-CUR USING :WS-ORDER-DATE END-EXEC PERFORM UNTIL SQLCODE = +100 EXEC SQL FETCH ORDER-CUR INTO :WS-ORDER-ID END-EXEC END-PERFORM EXEC SQL CLOSE ORDER-CUR END-EXEC
- Related Articles
- 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.
- (a) What is meant by a contact force? Explain with the help of an example.(b) What is meant by a non-contact force? Explain with the help of an example.
- What is the difference between DB2 JOIN and UNION? Explain with the help of an example
- Explain SHARED, UPDATE and EXCLUSIVE locks with the help of an example
- What are COLUMN functions in DB2? Explain with the help of an example
- What are oxidation and reduction? Explain the difference between them with the help of an example.
- Explain the concept of LOCK PROMOTION with the help of an example
- Explain join operations with the help of an example in DBMS
- 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.
- With the help of an example, explain how diffusion of gases in water is essential?
- What is an organic evolution? It cannot be equated with progress. Explain with the help of a suitable example.
- (a) What is the significance of the symbol of an element? Explain with the help of an example.(b) Explain the significance of the symbol H.
- What is NON CLUSTERED INDEX in DB2? Explain with the help of practical example

Advertisements