Programming Guide |
Suppresses repeating values in selected columns
DBMS [WITH CURSORcursor
] UNIQUEcolumn
[,column
...]
WITH CURSOR
cursor
- Name of declared
SELECT
cursor. If the clause is not used, Panther uses the defaultSELECT
cursor.column
- Column name in the
SELECT
statement.
DBMS UNIQUE
suppresses repeating values in each named column of a select set when the values are in adjacent rows. Typically, this feature is set for a column named in anORDER BY
clause.If the destination variable has a null edit, an occurrence containing a suppressed value is blank, not null.
The setting is turned off by executing the
DBMS UNIQUE
command with no arguments. Closing a cursor also turns off the setting. If a cursor is redeclared without being closed, the cursor continues to use to the setting forSELECT
statements andCONTINUE
commands.
// Since several titles can be rented to the same customer,
// suppress repeating customer numbers when listing
// outstanding rentals.proc rent_listDBMS DECLARE rent_cursor CURSOR FOR \
SELECT cust_id, title_id, copy_num, due_back FROM rentals \
WHERE due_back < today \
ORDER BY cust_idDBMS WITH CURSOR rent_cursor UNIQUE cust_id
DBMS WITH CURSOR rent_cursor EXECUTE
DBMS WITH CURSOR rent_cursor UNIQUE
return