Difference between revisions of "SET UNIQUE"

From Recital Documentation Wiki
Jump to: navigation, search
 
(One intermediate revision by one user not shown)
Line 1: Line 1:
==Class==
 
Indexing
 
 
 
 
==Purpose==
 
==Purpose==
 
Determine whether duplicate keys are to be included in index files
 
Determine whether duplicate keys are to be included in index files
Line 32: Line 28:
  
 
==Products==
 
==Products==
Recital Database Server, Recital Mirage Server, Recital Terminal Developer
+
Recital Server, Recital  
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Commands]]
 
[[Category:Commands]]

Latest revision as of 15:51, 25 November 2009

Purpose

Determine whether duplicate keys are to be included in index files


Syntax

SET UNIQUE ON | OFF | (<expL>)


See Also

APPEND, CHANGE, EDIT, Function Keys, INDEX, ON ERROR, REINDEX, REPLACE, SET PCUNIQUE, UNIQUE()


Description

If SET UNIQUE is ON when an index file is created or recreated, records with duplicate keys are discarded. The records still exist in the table, but there is no entry for them in the index file, so they are ’hidden’ from view. The unique status of the keys is stored in the index file, so whenever the index is associated with the table subsequently, the uniqueness of keys that are added to the index file is enforced.

If an attempt is made to add a duplicate key to a unique index file, the operation will not be able to complete. If a record is being appended or changed in the table through a full screen forms based command such as APPEND or CHANGE, then the system displays an appropriate message. The form cannot be exited until data entry is abandoned by pressing the [ABANDON] key, or a unique key is entered. If an attempt is made to update a record through the REPLACE command, an error message will be generated. This can be trapped with the ON ERROR command.

The UNIQUE keyword can also be included in the INDEX or REINDEX commands to provide the same effect as SET UNIQUE ON. By default, UNIQUE is OFF.


Example

use patrons
set unique on
index on name to persons


Products

Recital Server, Recital