Consultor Eletrônico



Kbase P133712: 4GL/ABL: Error (40) running a procedure which creates dynamic TEMP-TABLEs.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   9/18/2009
Status: Verified

SYMPTOM(s):

4GL/ABL: Error (40) running a procedure which creates dynamic TEMP-TABLEs.

SYSTEM ERROR: Attempt to define too many indexes. (40)

FACT(s) (Environment):

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

CAUSE:

The procedure repeatedly creates dynamic TEMP-TABLEs for database data tables as well as other locally defined TEMP-TABLEs without properly cleaning them when they are no longer needed. This causes number of active TEMP-TABLEs to steadily increase and the number of indexes to exceed the allowed limit.

FIX:

One solution is to delete any existing dynamic TEMP-TABLEs having the same name as the one about to be created. For example:
RUN DeleteExistingCopiesOfThisDynamicTempTable.p (INPUT "TT":u + DBTableName).

CREATE TEMP-TABLE tth.
tth:ADD-FIELDS-FROM(dbTableName).
tth:TEMP-TABLE-PREPARE("TT":u + DBTable).
Where DeleteExistingCopiesOfThisDynamicTempTable.p is the following procedure:
DEFINE INPUT PARAMETER ipcDynamicTTName AS CHARACTER NO-UNDO.
DEFINE VARIABLE hCurrentBuffer AS HANDLE NO-UNDO.
DEFINE VARIABLE hNextSibling AS HANDLE NO-UNDO.
DEFINE VARIABLE hTableHandle AS HANDLE NO-UNDO.
DEFINE VARIABLE cTableName AS CHARACTER NO-UNDO.
ASSIGN hCurrentBuffer = SESSION:FIRST-BUFFER.
DO WHILE VALID-HANDLE(hCurrentBuffer):
ASSIGN
hTableHandle = hCurrentBuffer:TABLE-HANDLE
cTableName = hCurrentBuffer:TABLE
hNextSibling = hCurrentBuffer:NEXT-SIBLING NO-ERROR.

IF cTableName EQ ipcTableName THEN DO:
hCurrentBuffer:BUFFER-RELEASE().
DELETE OBJECT hTableHandle.
LEAVE.
END.
hCurrentBuffer = hNextSibling NO-ERROR.
END.