SQLCommandGetValue Function

Help Contents

Introduction

The SQLCommandGetValue function returns a column value. The column value is taken from the current row of the result set of an SQLCommand Data Object. This function should only be called after SQLCommandFetchRow() has returned TRUE.

Syntax

Informal Syntax:

SQLCommandGetValue( CommandID, ColumnIndex )

Formal Syntax:

SQLCommandGetValue( 
        CommandID:=Expression,
        ColumnIndex:=Expression )

Parameters

The SQLCommandGetValue Function has these parameters:

Parameter Type Description
CommandID UDINT The identifier of the SQLCommand Data Object.
ColumnIndex UDINT The zero based column index of the value to return.

Return Value

The return value does not have a type. Use a Type Cast to convert the return value. For example:

TO_STRING( SQLCommandGetValue( CommandID, 0 ) )

The meaning of the return value depends on the type of SQL Command executed:

SQL CommandReturn Value
SELECT Statement The value of the column.
INSERT Statement No value returned. The function generates a runtime error
UPDATE Statement No value returned. The function generates a runtime error
DELETE Statement No value returned. The function generates a runtime error

Remarks

The function should only be called when:

Examples

For examples see the Examples section of the SQLCommandFromTagDB Function Block.

Standards Compliance

The SQLCommandGetValue Function is an extension to the IEC 61131-3 standard.

Further Information

SQLCommand Data Object

To learn how to use the SQLCommand data object.

Data Objects

To learn how to use data objects in IEC 61131-3 code.

IEC 61131-3

To learn how IEC 61131-3 is used in Fernhill SCADA.

Glossary

For the meaning of terms used in Fernhill SCADA.