Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone
I tried to add a context variable "Start" which is a date type.
If I start my talend job I'm able to choose a date but after that there are always errors.
Can't figure out how solve this issue
This is my example query:
select invno from invoicedata where convert(date, invoicedata.invno,104)=convert(date,(TalendDate.formatDate("yyyy-MM-dd HH:mm:ss",context.Start) ),104)
Thanks for any advice.
Is the code you have shown what is in your DB component? You need to keep in mind that the SQL you put in your component is actually a Java String. So you need to build it like a Java String. For example, if you want to add a context variable to a WHERE Clause, you need to do something like below....
"SELECT MyColumn1, MyColumn2, MyColumn3, MyColumn4 FROM MyTable WHERE MyColumn1 = '"+context.MyParam+"'"
The assumption above being that the data type of MyColumn1 and context.MyParam is String.
Is the code you have shown what is in your DB component? You need to keep in mind that the SQL you put in your component is actually a Java String. So you need to build it like a Java String. For example, if you want to add a context variable to a WHERE Clause, you need to do something like below....
"SELECT MyColumn1, MyColumn2, MyColumn3, MyColumn4 FROM MyTable WHERE MyColumn1 = '"+context.MyParam+"'"
The assumption above being that the data type of MyColumn1 and context.MyParam is String.