Function
This instruction is used to retrieve records from a table mapped by a DB_CreateMapping instruction into the DB
Map Variable specified in the MapVar in-out variable.
Define the DB Map Variable as an array when you want to retrieve more than one record.
The number of records retrieved to the DB Map Variable is output to the RecCnt output variable. The number of
records retrieved according to the retrieval conditions is output to the SelectedCnt output variable.
The relationship between the number of array elements in the DB Map Variable and the number of records in the
RecCnt and SelectedCnt output variables is described below.
[When the number of array elements of the DB Map Variable is equal to or smaller than (≤) the number of
retrieved records]
The records up to the maximum number of elements in the DB Map Variable are output.
For example, in the case where 30 records are retrieved for the DB Map Variable with 10 array elements, the
records from MapVar[0] to MapVar[9] are retrieved.
The value of RecCnt will be 10 and the value of SelectedCnt will be 30 in this case.
[When the number of array elements of the DB Map Variable is bigger than (>) the number of retrieved records]
The records up to the number of elements of the retrieved records are output. For the later elements, the records
are not retrieved, but the previous values are retained.
For example, in the case where 3 records are retrieved for the DB Map Variable with 10 array elements, the
records from MapVar[0] to MapVar[2] are retrieved. The values of MapVar[3] to MapVar[9] do not change.
The value of RecCnt will be 3 and the value of SelectedCnt will be also 3 in this case.
The records are retrieved according to the retrieval conditions specified in the Where input variable (WHERE
clause). The Where input variable is expressed as a text string.
The text string in the Where input variable cannot consist of NULL characters (16#00) only. In that case, the
instruction is terminated due to an error.
Specify the sort conditions in the Sort input variable (ORDER BY clause) to sort out the retrieved records. The
Sort input variable is expressed as a text string.
When the sort conditions are specified, the records are contained in the DB Map Variable in the order specified
by the sort conditions.
When the sort conditions are not specified, the output order to the DB Map Variable depends on the
specifications of the DB type to connect.