Programming Qparameters | Accessing tables with SQL statements
Conditions for WHERE entries
Condition Programming
Equals = ==
Not equal to != <>
Less than <
Less than or equal to <=
Greater than >
Greater than or equal to >=
Empty IS NULL
Not empty IS NOT NULL
Linking multiple conditions:
Logical AND AND
Logical OR OR
Example: selection of table rows
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"
Example: Select table rows with the WHERE function
20 SQL Q5 "SELECT Position_Nr,Measure_X,Measure_Y,
Measure_Z FROM Tab_Example WHERE
Position_Nr<20"
Example: Select table rows with the WHERE function and Q
parameter
20 SQL Q5 "SELECT Position_Nr,Measure_X,Measure_Y,
Measure_Z FROM Tab_Example WHERE
Position_Nr==:’Q11’"
Example: Define the table name with absolute path information
20 SQL Q5 "SELECT Position_Nr,Measure_X,Measure_Y,
Measure_Z FROM ’V:\table\Tab_Example’ WHERE
Position_Nr<20"
Example: Generate a table with CREATE TABLE
0 BEGIN PGM SQL_CREATE_TAB MM
1 SQL Q10 "CREATE SYNONYM NEW FOR 'TNC:\table
\NewTab.TAB'"
Create synonym
2 SQL Q10 "CREATE TABLE NEW AS SELECT X,Y,Z FROM
'TNC:\prototype_for_NewTab.tab'"
Create table
3 END PGM SQL_CREATE_TAB MM
9
HEIDENHAIN | TNC620 | Klartext Programming User's Manual | 01/2022
337