Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Talend Tutorials & Scenarios Prepared by Venkat Rathnam Tekuri

DELTA_OR_INCREMENTAL_LOAD with out control table.


We have to create 2 tables as per the below
Src:

select * from src_product;


------------- ----- ------------
PRODUCT_ID NUMBER(38)
PRODUCT_NAME VARCHAR2(50)
PRODUCT_TYPE VARCHAR2(50)
PRODUCT_PRICE NUMBER(38)
CREATED_ON DATE
MODIFIED_ON DATE

Target:
Name Null? Type
------------- ----- ------------
PRODUCT_ID NUMBER(38)
PRODUCT_NAME VARCHAR2(50)
PRODUCT_TYPE VARCHAR2(50)
PRODUCT_PRICE NUMBER(38)
CREATED_ON DATE
MODIFIED_ON DATE

Procedure:

 Drag and Drop the below components with Metadata tPreJob,tOracle


Connection,tOracleInput with TGT_PRODUCT metadata, tJavaRow,
 Create a 2nd Subjob with the following components Source with src_product metadata
with tOracleInput ,target tgt_product tables.
 Connect them together by using Row > Main link.
 Double click the tOracleInput with TGT_rpdouct define the properties .
"SELECT

max(CREATED_ON) as CREATED_ON ,
max(MODIFIED_ON) as MODIFIED_ON
FROM SRCVENKAT.TGT_PRODUCT"

 Double click the tJavaRow and define the properties .

// output_row.name = input_row.name.toLowerCase();

context.last_success=TalendDate.formatDate("dd-MM-yyyy",input_row.MODIFIED_ON);
context.current_run=TalendDate.formatDate("dd-MM-yyyy",TalendDate.getCurrentDate());
System.out.println("Last Success : " +context.last_success);
System.out.println("Current Run : " +context.current_run);

 Double click the tOracleInput with src_rpdouct define the properties .

"SELECT
SRCVENKAT.SRC_PRODUCT.PRODUCT_ID,
SRCVENKAT.SRC_PRODUCT.PRODUCT_NAME,
SRCVENKAT.SRC_PRODUCT.PRODUCT_TYPE,
SRCVENKAT.SRC_PRODUCT.PRODUCT_PRICE,
SRCVENKAT.SRC_PRODUCT.CREATED_ON,
SRCVENKAT.SRC_PRODUCT.MODIFIED_ON
FROM SRCVENKAT.SRC_PRODUCT
where TO_CHAR(created_on)>' " +context.last_success +
" 'or TO_CHAR(modified_on)>' " +context.last_success + " ' "

 Double click the tOracleoutput with tgt_rpdouct define the properties .


* Save the job and run the job

You might also like