Redundant duplicates can be eliminated from your result table by specifying the keyword DISTINCT in the SELECT statement.
Problem
Retrieve all customer states in CUSTOMERS, eliminating any duplicates.
Solution
.
.
(COBOL statements)
.
.
1 EXEC SQL
2 DECLARE CUSTLIST CURSOR FOR
3 SELECT DISTINCT STATE
4 FROM CUSTOMERS
5 END-EXEC.
.
.
(COBOL statements)
.
.
Line 3 The keyword DISTINCT specifies that any redundant duplicate values for STATE are to be eliminated from the result table. The result table includes one occurrence of each unique value for STATE.
|
Copyright © 2014 CA.
All rights reserved.
|
|