Executing multiple SQL statements with one tOracleRow component

Overview

Sometimes you need to execute multiple SQL statements using a single tOracleRow component, rather using multiple tOracleRow components to execute multiple SQL statements. This article explains how to execute multiple SQL statements in a single tOracleRow component.

 

Environment

This procedure was written with:

  • Talend Open Studio for DI 5.0-r72978
  • JDK version: Sun JDK build 1.6.0_26-b03
  • Operating system: Windows XP SP3

Talend verified this procedure to be compatible with:

  • Data Integration releases: 4.2.3, 4.2.4, 5.0.0, 5.0.1, 5.0.2, 5.1.1, 5.1.2, 5.2.0

 

Procedure

You can execute multiple statements with one tOracleRow component as follows:

begin
update table1 set name='Shong' where id=2;
update table1 set name='Patrick' where id=3;
delete from table1 where id=4;
commit;
end;

1_027.png

 

The above example has only DML statements. If the group of SQL statements contains DDL statements, you must use the EXECUTE IMMEDIATE command followed by the DDL statement. For example:

begin
update table1 set name='Shong' where id=2;
execute immediate 'drop table t3';
commit;
end;
Version history
Revision #:
2 of 2
Last update:
‎06-22-2017 10:18 PM
Updated by:
 
Labels (1)
Tags (1)