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

 

 

1 REPLY
Ten 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()";
-----------