Programming Qparameters | Accessing tables with SQL statements
9
Example for the SQL FETCH command
Remarks:
The gray arrows and associated syntax do not directly belong to
the SQL FETCH command
Black arrows and associated syntax indicate internal processes of
SQL FETCH
Define Parameter number for result (return
values for the control):
0: Successful read operation
1: Faulty read operation
Database: SQL access ID: Define Q parameter for
the HANDLE (for identifying the transaction)
Define Database: Index for SQL result (row
number within the result set)
Row number
Q parameter with the index
None defined: access to row 0
The optional syntax elements IGNORE UNBOUND
and UNDEFINE MISSING are intended for the machine
manufacturer.
Example: Transfer row number in the Q parameter
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"
. . .
20 SQL Q5 "SELECT Position_Nr,Measure_X,Measure_Y,
Measure_Z FROM Tab_Example"
. . .
30 SQL FETCH Q1 HANDLE Q5 INDEX+Q2
Example: Program the row number directly
30 SQL FETCH Q1 HANDLE Q5 INDEX5
340
HEIDENHAIN | TNC620 | Klartext Programming User's Manual | 01/2022