delete
The EGL delete statement provides the fundamental "delete" capability for the language. It removes a record from a file, a row from a relational database, or a segment from a hierarchical database.
In most cases, you must place a hold on a record before you can delete it. To place a hold on a record, use the get statement with the forUpdate option.
The exact behavior of the statement depends on the way you have stereotyped your record variable (see Stereotypes).
Syntax

- recordVariable
- This record variable contains the information to be deleted from the data source.
- deleteOptions
- Depending on how you stereotyped your record variable, some options might be available to make the delete statement more specific. See the considerations for specific data access technologies.
- with explicitCode
- Depending on how you stereotyped your record variable, you might be able to specify explicit code here. See the considerations for specific data access technologies.
- from listID
- If you are not working with the default data source that is associated with this record variable, specify a list ID. This is the character string you used to identify the list that was previously created in an EGL open or get statement. You must use a forUpdate option with the open or get statement if you want to perform a delete later.
Example
In the following example, the user has submitted a request to delete a displayed record. The program must get and hold the record variable containing the specified information before deleting the record:
if (userRequest == "D")
try
get myCustomer forUpdate;
onException(ex AnyException)
myErrorHandler(ex); // exits the program
end
try
delete myCustomer;
onException(ex AnyException)
myErrorHandler(ex);
end
end