Difference between revisions of "SET UNIQUE"

From Recital Documentation Wiki
Jump to: navigation, search
Line 12: Line 12:
  
 
==See Also==
 
==See Also==
[[APPEND]], [{CHANGE]], [[EDIT]], [[Function Keys]], [[INDEX]], [[ON ERROR]], [[REINDEX]], [[REPLACE]], [[SET PCUNIQUE]], [[UNIQUE()]]
+
[[APPEND]], [[CHANGE]], [[EDIT]], [[Function Keys]], [[INDEX]], [[ON ERROR]], [[REINDEX]], [[REPLACE]], [[SET PCUNIQUE]], [[UNIQUE()]]
  
  

Revision as of 13:54, 20 April 2009

Class

Indexing


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 Database Server, Recital Mirage Server, Recital Terminal Developer