Show TOC

 Logical Sequence of Database OperationsLocate this document in the navigation structure

Database requests are interconnected and always occur in the same logical sequence.

The DECLARE function defines and numbers the cursor. DECLARE precedes the PREPARE function.

Use PREPARE to prepare a specific SQL statement, such as:

 select * from sflight where carrid eq 'LH'.

and define the access method before the system can transfer the request to the database. During this preparation, the system is concerned only with the structure of the SQL statement and not with the values it contains.

The OPEN function takes the prepared SELECT statement and completes it with the correct values. In the above example, OPEN would issue the field carrid the value LH.

FETCHpasses the entries from the database to the database interface of the SAP System All of the database operations required to execute an SQL statement are linked by the same cursor ID.

If the SQL statement makes changes in the database (INSERT, UPDATE, DELETE), PREPARE is followed by EXEC, which executes the statement

If the system can refer back to an SQL statement that has already been prepared, there is no PREPARE operation, and the statement is executed using REOPEN or REEXEC as appropriate