Inserting and updating data table records, Stored procedures – Rockwell Automation FactoryTalk Transaction Manager User Guide User Manual

Page 93

Advertising
background image

6

Defining Data Objects

93

Inserting and Updating Data Table Records

When logging data to a table, you can use FactoryTalk Transaction Manager
to directly insert data, which creates new records in the table, or update
existing data in the table. The default setting is Insert, but you can change it
by selecting the option for the given data object. When the Update option is
selected, some of the data points may be used as criteria for selecting rows to
be updated, while other data points are used to update the values in the
selected columns. If no rows match the given criteria, the data will be
inserted into a new row.

Stored Procedures

A stored procedure is a user-defined function or program that is executed
inside of the database; it can consist of any of the components of a structured
language that enable you to define data behavior. A stored procedure can be
simple like a single select command or complicated like validating all data
before it is inserted into a table.

A stored procedure works like a function that is stored in a database. Most
databases provide a comprehensive stored procedure language that
combines the data query capabilities of SQL and some kind of procedural
control (for example, an If…Then statement). As with most kinds of
function calls, a stored procedure can have both inputs and outputs. In a
transaction that is connected to a stored procedure, the values bound to
inputs are collected from the control system and the outputs are returned to
the control system.

When you create a data object and select the Stored Procedure radio button
on the Data Object Definition dialog box, FactoryTalk Transaction Manager
queries the database for all stored procedures accessible by the chosen
database user account and lists them in the stored procedure list box. When
you select a stored procedure, the input and output parameters display in the
lower pane. Since all parameters for a stored procedure are required, the

Advertising