Mandalika has Published 470 Articles

Difference between UNION and UNION ALL in DB2

Mandalika

Mandalika

Updated on 30-Nov-2020 09:08:59

3K+ Views

The UNION in DB2 is used to merge two or more SELECT statements. The SELECT statements can be on a single table or on multiple tables. Each SELECT statement is processed individually and their results are combined to give us the final result rows.The UNION statement will eliminate the duplicate ... Read More

What is Fixed-list SELECT? Give the syntax and explain with help of an example

Mandalika

Mandalika

Updated on 30-Nov-2020 09:08:05

220 Views

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 ... Read More

What is the difference between EXECUTE IMMEDIATE and EXECUTE WITH PREPARE in DB2?

Mandalika

Mandalika

Updated on 30-Nov-2020 09:06:42

861 Views

The EXECUTE IMMEDIATE and EXECUTE PREPARE are the forms of dynamic SQL. In case of EXECUTE immediate, we can give the SQL statement in the host variable and pass this host variable in EXECUTE IMMEDIATE.Following example demonstrates these forms.Example01 WS-SQL-DECLARE    05 WS-SQL-LEN   PIC S9(04) COMP.    05 WS-SQL-QUERY ... Read More

Explain the concept of DYNAMIC SQL in DB2 with the help of an example

Mandalika

Mandalika

Updated on 30-Nov-2020 09:04:45

1K+ Views

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, ... Read More

What is the significance of the QBLOCK_TYPE and JOIN_TYPE column of a PLAN table?

Mandalika

Mandalika

Updated on 30-Nov-2020 09:03:55

165 Views

The QBLOCK_TYPE column of the PLAN_TABLE mainly gives the information about the type of query. It can have the value as CORSUB which indicates that the query is Correlated subquery and NCOSUB indicates that the query is Non-correlated subquery.The JOIN_TYPE column indicates the type of join used in the query. ... Read More

What is the significance of ACCESSTYPE and INDEXONLY column of a PLAN table in DB2?

Mandalika

Mandalika

Updated on 30-Nov-2020 09:03:06

592 Views

The PLAN_TABLE in DB2 contains details of the access paths used by the optimizer from the EXPLAIN statement. This table gives much information about the PLAN having DB2 SQL statements.ACCESSTYPE is one of the columns of PLAN_TABLE which gives details regarding the access type. The values which can be present ... Read More

What is the use and syntax of SEQUENCE in DB2?

Mandalika

Mandalika

Updated on 30-Nov-2020 09:02:16

371 Views

A sequence is used to generate the unique ID automatically. We can define a column in the DB2 table as type SEQUENCE. This will enable DB2 to automatically generate a unique ID for every new row inserted in the table. The auto ID generated by the DB2 remains unique throughout ... Read More

Difference between CORRELATED and UNCORRELATED subqueries in DB2

Mandalika

Mandalika

Updated on 30-Nov-2020 09:01:19

3K+ Views

The subquery is a nested query. When this subquery is executed only once and the result of this subquery is used to extract the data in the main query, then this type of subquery is known as UNCORRELATED subquery. On the other hand, when a subquery refers to the main ... Read More

Usage and syntax of INNER and OUTER JOIN in DB2

Mandalika

Mandalika

Updated on 30-Nov-2020 09:00:15

6K+ Views

Problem: How to explain INNER JOIN and OUTER JOIN with the help of an example on ORDERS and TRANSACTION DB2 table.SolutionThe JOIN is used to combine data from one or more tables in DB2. There are two main types of JOIN — INNER JOIN and OUTER JOIN. The basic difference ... Read More

How can you revert all the DB2 table changes done in a COBOL-DB2 program?

Mandalika

Mandalika

Updated on 30-Nov-2020 08:58:19

4K+ Views

We can revert all the changes done on a COBOL-DB2 program using the ROLLBACK statement. However, ROLLBACK is only applicable until COMMIT has not been issued. If we have used a COMMIT statement, then ROLLBACK will revert all the changes made in DB2 tables after the last COMMIT point.For example, ... Read More

Previous 1 ... 7 8 9 10 11 ... 47 Next
Advertisements