Multi Update Table
Multi Update Table executes SQL statements against incoming records to modify one or more
tables in a database.
Multi Update Table treats each input record as a completely separate piece of work. All
database operations performed for a given input record must succeed in order for the results
of the operations to be committed to the database. Otherwise, if any of the specified
operations fails for a record, all operations for that record are rolled back.
Properties of Multi Update Table
Count: Specifies the number of SQL statement pairs (primarySql-n and secondarySql-n) and
associated filter-n expressions. Default is 1.
Continuous: Specifies whether this component will work in continuous graphs.
DBConfigFile: Name of the database table configuration file.
Primarysqln: Specifies an SQL statement to be applied to the current record to update a
table.
Secondarysqln: Specifies a secondary SQL statement to be applied to the current record to
update a table. The statement specified in a secondary SQL parameter is executed on a record
only if the statement in its associated primarySqln parameter has failed for that record.
Transformn: Transformations package to be executed with primarysqln and secondarysqln
statements.
Filtern: A DML expression that is applied to the current record. The result of its evaluation
determines whether the corresponding SQL statement pair is executed. Filters are optional; if
no expression is specified for a given filter, the associated SQL statements are always
executed.
BatchSize: Specifies the rate at which successful records should be committed.
CommitTable: Database table in which to store commit progress. This is an internally used
table; it is not the table against which the SQL is executed. You should set this parameter only
when you set the commitNumber parameter.
Jobid: Unique Job identifier.
ActionRequired: Specifies whether an error should be issued if an input record results in no
change to the database for any SQL statement parameter pair.
When ActionRequired is true, every one of the defined SQL statement pairs must change the
database state for each record, in order for the transaction to be committed. If they don't,
then:
If the reject port is not connected, the graph fails.
If the reject port is connected, the record is sent to it, and the graph continues running.
When ActionRequired is false, if any of the SQL statement pairs changes the database state for
a record, the transaction will be committed. Records that result in no change to the database
for all of the defined SQL statement pairs:
Will be sent to the unused port, if it is connected
Are simply discarded, if the unused port is not connected
The reject port has no relevance if ActionRequired is false.
Sample Graph
*******************************************************
Example 1 – Using primary and secondary sql
Input
record
string("|") brnd_id;
string("|") brnd_nm;
string("\n") brnd_desc;
end
Existing record values in table
No records with DF as brnd_id.
But for Venture there is 1 record
Query:
Primarysqln:
update PXPT.BRND set brnd_nm = :brnd_nm, brnd_desc = :brnd_desc where brnd_id
= :brnd_id
Secondarysqln:
update PXPT.BRND set brnd_nm = :brnd_nm,brnd_desc = :brnd_desc where brnd_id =
'Venture'
Parameter
Output in table:
*******************************************************
Example 2 – Transform Function
Queries are executed based on the transformations mentioned.
Input
record
string("|") key;
string("|")[delimiter == "end"] Vec;
string("\n") newline;
end
Query:
Primarysql0:
insert into
PXAP.APPN_ORIGTN_SRC(appn_origtn_src_id,appn_origtn_src_desc,ods_cretn_ts,ods_cr
etn_user_id,ods_publn_ts,ods_publn_user_id) values (:key,'product','2011-11-28-
13.10.23.123456','TPXDAM1','2011-11-28-13.10.23.123456','TPXDAM1')
Primarysql1:
insert into
PXPT.BRND(brnd_id,brnd_nm,brnd_desc,brnd_actv_ind,ods_cretn_ts,ods_cretn_user_id
,ods_publn_ts,ods_publn_user_id) values (:k,:s,'product','Y','2011-11-28-
13.10.23.123456','TPXDAM1','2011-11-28-13.10.23.123456','TPXDAM1')
Existing record values in table
In PXAP.APPN_ORIGTN_SRC:
In PXPT.BRND:
Transformation:
type statement_input_type=record
string(25) k;
string(20) s;
end;
out :: length(in) =
begin
out :: length_of(in.Vec);
end;
statement_input :: compute_statement_input(in, index) =
begin
statement_input.k :: in.Vec[index];
statement_input.s :: in.key;
end;
Parameter
Output in table:
In PXAP.APPN_ORIGTN_SRC:
In PXPT.BRND:
*******************************************************
Example 3 – Filter condition
Only the input records satisfying filter condition will be processed.
Input
record
string("|") brnd_id;
string("|") brnd_nm;
string("\n") brnd_desc;
end
Existing record values in table
Query:
update PXPT.BRND set brnd_nm = :brnd_nm, brnd_desc = :brnd_desc where brnd_id
= :brnd_id
Filtern:
brnd_nm == 'closeup'
Parameter
Output in table: