Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
_AnonymousUser
Specialist III
Specialist III

context variable

Hi,
I am working on incremental Talend Job and looking for Incremental Extract logic. I did the following steps to achieve this (DB:- Oracle)
Step1. Took Max (HEADER_ID) FROM TARGET_TABLE. (header_id datatype is Number)
Step2. Then I took tJavaRow component for to assign Step1 value context variable. My Context variable name is HEADER_ID (Datatype is BigDecimal) So the assignment syntax is as below
context.HEADER_ID=input_row.HEADER_ID;
Step3. Next I have my source extract component and have below Query.
"select C1, C2, HEADER_ID FROM SOURCE_TABLE WHERE HEADER_ID > '+context.HEADER_ID+'"
Step4. Then i have tMap
Ste5.  Then i have Target Objects
I am getting Error message on Step3. like '(java.sql.SQLSyntaxErrorException: ORA-01722: invalid number  ....)
It seems that there is datatype mismatch but I am not sure where to Fix.
Regards
Saket Krishna

Labels (2)
13 Replies
Anonymous
Not applicable

Hi [size=3][font=Times New Roman] Saket Krishna,[/font][/size]
[size=3][font=Times New Roman] Did you use the "date" (your context variable is a date) as part of a SQL statement in tOracleInput?[/font][/size]

Best regards
Sabrina
Anonymous
Not applicable

Hi Chitra

An "Null Pointer Exception" will occur if your variable is null. Did you get this error in tMap component?
You need to handle the null value, for example;
row1.name==null?value if it is null:do your further processing
Best regards
Sabrina
Anonymous
Not applicable

Hi Sabrina,
Yes My context variable is defined as Date datatype and the SQL in the tOracleInput is just as below in where condition.
Select C1, C2, C3 FROM <TABLE> WHERE <TABLE>.CREATION_DATE > TO_DATE('" + context.CREATION_DT + "','dd - MM - yyyy').
I was thinking if possible then I can share my screen with you so that you can have a close look on the code. You can reach me on skrishna@ctrworld.com
Thanks
Saket Krishna
Anonymous
Not applicable

Hi Saket Krishna,

The sql statement should be String not date.
You can use the TalendDate.formatDate() method to format the data.

Best regards
Sabrina