Show TOC

Defining a SELECT StatementLocate this document in the navigation structure

Use

You use this statement to select table values. The statement corresponds to an SQL SELECT statement.

Format of SELECT Statement

<StatementName>

<dbTableName action="SELECT">

<table>realDbTableName</table>

<access>

<col1/>

<col2/>

<col3/>

</access>

<key1>

<col2>val2old</col2>

<col4>val4</col4>

</key1>

<key2>

<col2>val2old2</col2>

</key2>

</dbTableName>

</StatementName>

Procedure
  1. Enter the column names to be selected in the <access>block.

    A statement with the action SELECT must have exactly one <access> element.

  2. In a <key> element, enter the condition that can find the data records whose column values are to be selected.

    You can define any number of <key>elements.

    Column values within a <key> element are combined with a logical AND; different <key> elements are combined with a logical OR.

    • If you do not define the <key>element, or if you define an empty <key> element, this means that no condition is specified and that the entire table is to be selected. If you want to ensure this does not happen, select Key Tags Mandatory in the adapter configuration.
    • If you have not formulated a condition in the <key>elements, but have selected Key Tags Mandatory, this results in an error in message processing with a corresponding error output.
Result

The corresponding SQL statement for the XML structure above is as follows:

"

SELECT col1,col2,col3 FROM dbTableName  WHERE ((col2='val2old' AND col4='val4') OR (col2='val2old2'))

"

The response document contains the result of the action in XML format as follows:

"

<row>

<column1>value11</column1>

<column2>value12</column2>

...

</row>

...

<row>

<column1>valueN1</column1>

<column2>valueN2</column2>

...

</row>

"