Completing a transaction with SQL COMMIT
Application
SQL COMMIT simultaneously transfers all of the rows that have been changed and added in a transaction back into the table. The transaction is defined via the HANDLE to be specified. In this context, a lock that has been set with SELECT...FOR UPDATE resets the control.
Requirements
- Code number 555343
- Table exists
- Appropriate table name
The names of tables and table columns must start with a letter and must not contain an arithmetic operator (e.g., +). Due to SQL commands, these characters can cause problems when data are input or read.
Description of function
The assigned HANDLE (operation) loses its validity.
The control shows in the defined variable whether the read operation was successful (0) or incorrect (1).
Input
11 SQL COMMIT Q1 HANDLE Q5 | ; Complete all rows of transaction Q5 and update table |
The NC function includes the following syntax elements:
Syntax element | Meaning |
---|---|
SQL COMMIT | Syntax initiator for the COMMIT SQL command |
Q/QL/QR or Q REF | Variable in which the control stores the result |
HANDLE | Q parameter with identification of the transaction |
Example
11 SQL BIND Q881 "Tab_Example.Position_Nr" |
12 SQL BIND Q882 "Tab_Example.Measure_X" |
13 SQL BIND Q883 "Tab_Example.Measure_Y" |
14 SQL BIND Q884 "Tab_Example.Measure_Z" |
* - ... |
21 SQL Q5 "SELECT Position_Nr,Measure_X,Measure_Y, Measure_Z FROM Tab_Example" |
* - ... |
31 SQL FETCH Q1 HANDLE Q5 INDEX+Q2 |
* - ... |
41 SQL UPDATE Q1 HANDLE Q5 INDEX+Q2 |
* - ... |
51 SQL COMMIT Q1 HANDLE Q5 |