Sql update, Sql insert, 9 a c cessing t a bles with sql commands – HEIDENHAIN TNC 640 (34059x-01) User Manual

Page 293

Advertising
background image

HEIDENHAIN TNC 640

293

8.9 A

c

cessing T

a

bles with SQL Commands

SQL UPDATE

SQL UPDATE

transfers the data prepared in the Q parameters into the

row of the result set addressed with INDEX. The existing row in the
result set is completely overwritten.

SQL UPDATE

takes into account all columns entered in the "Select"

command.

U

Parameter no. for result

: Q parameter in which the

SQL server reports the result:
0: No error occurred.
1: Error occurred (incorrect handle, index too large,
value outside of value range or incorrect data format)

U

Database: SQL access ID

: Q parameter with the

handle for identifying the result set (also see SQL
SELECT

)

U

Database: Index for SQL result

: Row number within

the result set. The table entries prepared in the
Q parameters are written to this row. If you do not
enter an index, the first row is written to (n=0).
Either enter the row number directly or program the
Q parameter containing the index.

SQL INSERT

SQL INSERT

generates a new row in the result set and transfers the

data prepared in the Q parameters into the new row.

SQL INSERT

takes into account all columns entered in the "Select"

command. Table columns not entered in the "Select" command are
filled with default values.

U

Parameter no. for result

: Q parameter in which the

SQL server reports the result:
0: No error occurred.
1: Error occurred (incorrect handle, value outside of
value range or incorrect data format)

U

Database: SQL access ID

: Q parameter with the

handle for identifying the result set (also see SQL
SELECT

)

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

. . .

40 SQL UPDATE Q1 HANDLE Q5 INDEX+Q2

Example: Row number is programmed directly

. . .

40 SQL UPDATE Q1 HANDLE Q5 INDEX5

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"

. . .

40 SQL INSERT Q1 HANDLE Q5

Advertising