sql query not executing.

Five Stars

sql query not executing.

please help me with this. after executing this query in tjava it prompts as unparseble date.

context.Query_string="select date_key,inc_date from date_dim where inc_date >'" +TalendDate.formatDate("yyyy-MM-dd",TalendDate.parseDate("dd-MM-yyyy",context.Last_Loaded_Date))+"'and inc_date < now()";error.png

 

 

Forteen Stars

Re: sql query not executing.

as variant (if exclude empty string in Last_Loaded_Date - it also possible, so check with debug what You have as input), but also

You have missed the space between ' and and

context.Query_string="select date_key,inc_date from date_dim where inc_date >'" +TalendDate.formatDate("yyyy-MM-dd",TalendDate.parseDate("dd-MM-yyyy",context.Last_Loaded_Date))+"'and inc_date < now()";

this is make date like - 2015-01-01and which is unparseable 

context.Query_string="select date_key,inc_date from date_dim where inc_date >'" +TalendDate.formatDate("yyyy-MM-dd",TalendDate.parseDate("dd-MM-yyyy",context.Last_Loaded_Date))+"' and inc_date < now()";
-----------

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach

Watch