Consultor Eletrônico



Kbase P105856: 4GL/ABL: Errors (396) and (142) trying to update database table records.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   11/26/2008
Status: Verified

SYMPTOM(s):

4GL/ABL: Errors (396) and (142) trying to update database table records.

** <filename> record has NO-LOCK status, update to field not allowed. (396)

** Customer record has NO-LOCK status, update to field not allowed. (396)

** Unable to update <filename> Field. (142)

** Unable to update Customer Field. (142)

Executing code similar to:
DEFINE QUERY q FOR customer.
OPEN QUERY q FOR EACH customer NO-LOCK.
GET FIRST q.
GET CURRENT q.
ASSIGN NAME = "New Name Value".

FACT(s) (Environment):

All Supported Operating Systems
Progress 9.x
OpenEdge 10.x

CAUSE:

The record is being read with the NO-LOCK option. Records to be updated must to be fetched with either the EXCLUSIVE-LOCK or the SHARE-LOCK option. The SHARE-LOCK option is upgraded to EXCLUSIVE-LOCK during the actual modification of the data unless some other user happens to be holding the same record with the SHARE-LOCK option also.

FIX:

Modify the GET CURRENT statement to fetch the customer record with an EXCLUSIVE-LOCK:
DEFINE QUERY q FOR customer.
OPEN QUERY q FOR EACH customer NO-LOCK.
GET FIRST q.
GET CURRENT q EXCLUSIVE-LOCK.
ASSIGN NAME = "New Name Value".