Binding a variable to a table column with SQL BIND
Application
SQL BIND links a Q parameter to a table column. The SQL commands FETCH, UPDATE, and INSERT evaluate this binding (assignment) during data transfer between the result set and the NC program.
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
Program any number of bindings with SQL BIND..., before using the FETCH, UPDATE, or INSERT commands.
An SQL BIND command without a table name or column name cancels the binding. At the latest, the binding is terminated at the end of the NC program or subprogram.
Input
11 SQL BIND Q881 "Tab_example.Position_Nr" | ; Bind Q881 to the "Position_No" column of the "Tab_Example" table |
To navigate to this function:
Insert NC function All functions FN SQL SQL BIND
The NC function includes the following syntax elements:
Syntax element | Meaning |
---|---|
SQL BIND | Syntax initiator for the BIND SQL command |
Q, QL, QR, QS, or Q REF | Variable to be bound |
Name or QS | Table name and table column, separated by . or QS parameter with definition Fixed or variable name Optional syntax element |
Notes
- Enter the path of the table or a synonym as the table name.
- During the read and write operations, the control considers only those columns that you have specified by means of the SELECT command. If you specify columns without a binding in the SELECT command, then the control interrupts the read or write operation with an error message.