Clean up a dynamic query
- Last Updated: October 15, 2024
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
Like any other dynamic object, you should always delete a dynamic query when you’re done with
it. If you create a query in a named widget pool, or if there is an unnamed widget pool
associated with the procedure where you create the query, then you can use the widget
pool mechanism to control when the query is deleted. Otherwise, it’s important to use
the DELETE OBJECT statement to delete the query object when you’re done
using it.
However, if you need another dynamic query, perhaps for a different buffer, then it is
good practice to reuse an existing query object rather than deleting one query and then
creating another one. Reusing an existing dynamic query object is much more efficient
than creating a new one each time you need one. You can change the buffers of an
existing query object with the SET-BUFFERS() method and then use the
other methods, such as QUERY-PREPARE(), to change the use of the same
query object entirely. You should still be sure to delete the object when you’re done
with it.