Kbase P97929: Error 40 when creating uncessary dyn temp-table to pass records. One can just share a dun buffer in
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  02/12/2004 |
|
Status: Unverified
SYMPTOM(s):
SYSTEM ERROR: Attempt to define too many indexes. (40)
Using INPUT-OUTPUT TABLE-HANDLE or OUTPUT TABLE-HANDLE parameter type to pass records
CAUSE:
Error 40 is known to occur when there is a Dynamic temp-table leak in the code of the application. A new dynamic temp-table is created each time a procedure is run with a INPUT-OUTPUT/OUTPUT TABLE-HANDLE parameter. It is up to the caller procedure to delete the new dynamic temp-table object in the caller procedure when it is no longer needed.
FIX:
There are multiple ways to solve this problem, especially if everything is running only within the client session (no AppServer involved):
1) Delete the dynamic temp-table object once it is not needed.See Progress Solution P13898 Memory Leak using TEMP-TABLEs as parameters to internal procedures.
2) If everything takes place within the client session, and if the point of using OUTPUT TABLE-HANDLE is just to get some records back from the called procedure (possibly called from a REPEAT loop), then perhaps it is not necessary to create a brand new temp-table for each record to add. In other words, if the records could just be added to the same one single temp-table, then the best way is just send the HANDLE of a BUFFER of this temp-table (possibly the DEFAULT-BUFFER-HANDLE) as a simple INPUT PARAMETER instead of using a TABLE-HANDLE parameter. Thus the called procedure shall just use hBuffer:BUFFER-CREATE() to add records to the temp-table. This approach is like sharing one temp-table and will result in a large performance gain since it refrains from creating and deleting unecessary temp-table objects.