beautypg.com

Sql fetch, 10 .9 a ccessing t a bles with sql commands – HEIDENHAIN TNC 320 (340 551-01) User Manual

Page 353

background image

HEIDENHAIN TNC 320

353

1

0

.9 A

ccessing T

a

bles with SQL Commands

SQL FETCH

SQL FETCH

reads the row addressed with INDEX from the result set, and

places the table entries in the bound (assigned) Q parameters. The
result set is addressed with the HANDLE.

SQL FETCH

takes into account all columns entered in the "Select"

command.

8

Parameter no. for result:

Q parameter in which the

SQL server reports the result:
0: No error occurred.
1: Error occurred (incorrect handle or index too large)

8

Data bank: SQL access ID:

Q parameter with the

handle for identifying the result set (also see SQL
SELECT

).

8

Data bank: Index for SQL result:

Row number

within the result set. The table entries of this row are
read and are transferred into the bound parameters. If
you do not enter an index, the first row is read (n=0).
Either enter the row number directly or program the
Q parameter containing the index.

Example: Row number is transferred in a
Q parameter

11 SQL BIND Q881 "TAB_EXAMPLE.MEAS_NO"

12 SQL BIND Q882 "TAB_EXAMPLE.MEAS_X"

13 SQL BIND Q883 "TAB_EXAMPLE.MEAS_Y"

14 SQL BIND Q884 "TAB_EXAMPLE.MEAS_Z"

. . .

20 SQL Q5 "SELECT MEAS_NO,MEAS_X,MEAS_Y,
MEAS_Z FROM TAB_EXAMPLE"

. . .

30 SQL FETCH Q1 HANDLE Q5 INDEX+Q2

Example: Row number is programmed directly

. . .

30 SQL FETCH Q1 HANDLE Q5 INDEX5