Consultor Eletrônico



Kbase P20090: How to trap and suppress the record uniqueness violation error (132)?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   12/04/2005
Status: Verified

GOAL:

How to trap and suppress the record uniqueness violation error (132)?

GOAL:

How to trap and suppress the error: <file-name> already exists with <field/value...>. (132)

FIX:

1) Use the VALIDATE statement with the NO-ERROR option to set the ERROR-STATUS:ERROR attribute to TRUE if indexing fails.

2) If the ERROR condition is raised, UNDO the transaction and code remedial action:


CREATE TableName NO-ERROR.
ASSIGN FieldName = 'SomeValue' NO-ERROR.
VALIDATE TableName NO-ERROR.

IF ERROR-STATUS:ERROR THEN
DO:
MESSAGE "record already exists" VIEW-AS ALERT-BOX INFO BUTTONS OK.
UNDO.
END.