Adding and deleting records
- Last Updated: January 17, 2024
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
Adding and deleting records
To add records to a database, you can use either the CREATE or INSERT statements.
The CREATE statement places a newly created record
in the database, but does not display the record or request user
input. All fields in the record are set to the initial values specified
in the Data Dictionary. The CREATE statement causes
any CREATE trigger associated with the table to
execute. This trigger may set fields in the record to new values.
The INSERT statement not only creates the record,
but also displays the record and requests input.
The INSERT statement is composed of four other statements—the CREATE, DISPLAY, PROMPT–FOR and ASSIGN statements.
Three of these statements (DISPLAY, PROMPT–FOR,
and ASSIGN) comprise the UPDATE statement.
You can emulate an INSERT statement by using the
four statements, or by using the CREATE and UPDATE statements.
This is more flexible than using the INSERT statement
alone.
For example, the INSERT statement always displays fields
in the order they are defined in the schema. The UPDATE statement
lets you specify the order they are displayed. Note that if you
use an INSERT statement, the CREATE trigger
is executed before the record is displayed.
To delete records from a database, use the DELETE statement.
The DELETE statement causes any DELETE trigger
associated with the table to execute.