Delete Object 91c

emnu

Member
Hi,

I get next error message when i want to execute delet object on a temp-table handle:

Cannot delete the default buffer for a TEMP-TABLE object-delete the TEMP-TABLE object instead (328) (9037)

This is a snapshot of the code:

/* TT handle is returned from appserver session */
RUN prcGetTable IN hProc (OUTPUT TABLE-HANDLE hTTChanged).

bhTTChanged = hTTChanged:DEFAULT-BUFFER-HANDLE.
CREATE QUERY qhTTChanged.
qhTTChanged:SET-BUFFERS(bhTTChanged).
qhTTChanged:QUERY-PREPARE("for each ttChanged":U).
qhTTChanged:QUERY-OPEN().
qhTTChanged:GET-FIRST(NO-LOCK).

... Do some Stuff ...

/* delete uneeded objects */
qhTTChanged:QUERY-CLOSE().
bhTTChanged:BUFFER-RELEASE().
DELETE OBJECT qhTTChanged. /* error on this */
DELETE OBJECT bhTTChanged.

Any Clue ?

Thanx for any response,

Emmanuel.
 

dkellgren

Member
Because "qhTTChanged" is not a deleteable object (it's a temp-table). You don't need to release it back to the system.
 

jongpau

Member
Hi Emmanuel,

If it's a dynamic temp-table, you can (and should) delete it using DELETE OBJECT. However, you are trying to delete the (default)buffer of the temp-table, and you cannot do that. To delete the temp-table you can try this:
DEF VAR lhTempTable AS HANDLE NO-UNDO.
..
..
lhTempTable = bhttChanged:TABLE-HANDLE.
..
..
DELETE OBJECT lhTempTable.

This should free up all memory used by the temp-table, delete it's contents and the temp-table structure.

HTH
 
Top