3 Programming the DB Connection Function
3-17
NJ/NX-series Database Connection CPU Units User’s Manual (W527)
3
-3-3 Restrictions on DB Map Variables
Precautions for Correct Use
When a DB Connection Instruction is used in a function block and an in-out variable of the
function block is specified as a DB Map Variable, system-defined initial values for the data
types are applied to the members of the DB Map Variable when the DB Connection
Instruction is executed. Do not specify an in-out variable of a function block as a DB Map
Variable.
If you need to use an in-out variable for a DB Connection Instruction, specify an internal
variable of the function block as a DB Map Variable and transfer the data between in-out
variable and internal variable using a MOVE or other instruction before executing a
DB_Insert or DB_Update instruction or after executing a DB_Select instruction.
3-3-3 Restrictions on DB Map Variables
This section describes the restrictions on DB Map Variables.
Array Specification for Data Type of DB Map Variables by SQL Type
Whether you can specify a structure array for DB Map Variables depends on SQL type.
The following table shows the details.
Specifying a structure array for DB Map Variable
INSERT Not possible
UPDATE
Mapping Cannot be Created for a DB Map Variable
Mapping cannot be created for a DB Map Variable in the following cases. The
DB_CreateMapping (Create DB Map) instruction ends in an error.
ï‚– When the data type of the DB Map Variable is not a structure
ï‚– When a derivative data type is contained in structure members of the DB Map Variable
ï‚– When a structure array is specified for a DB Map Variable though INSERT or UPDATE is
specified for the SQL type in the instruction.
An Error Occurs when a Record Processing Instruction is Executed
No error is detected when a mapping is created for a DB Map Variable by executing a
DB_CreateMapping (Create DB Map) instruction. The DB_Insert (Insert DB Record), DB_Update
(Update DB Record), or DB_Select (Retrieve DB Record) instruction will result in an error.
ï‚– When the DB cannot be connected
ï‚– When the specified table does not exist in the DB
ï‚– When a member name of the DB Map Variable does not match a column in the table
 When a member’s data type does not match the data type of the corresponding column