<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Talend Context Variable with Date DataType in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Talend-Context-Variable-with-Date-DataType/m-p/2311378#M82425</link>
    <description>&lt;P&gt;The data type of the context variable CLOSING_MONTH is of Date type right?&lt;/P&gt;
&lt;P&gt;To use this value in your query you have to format the Date typed value into a compatible String for your query.&lt;/P&gt;
&lt;P&gt;You can do that with the routine TalendDate.&lt;/P&gt;
&lt;PRE&gt;select id, due_date
 from my_table
 where trunc(due_date) &amp;lt; '" + TalendDate.formatDate("yyyy-MM-dd", context.CLOSING_MONTH) + "'&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 30 Jun 2019 21:42:17 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-06-30T21:42:17Z</dc:date>
    <item>
      <title>Talend Context Variable with Date DataType</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Talend-Context-Variable-with-Date-DataType/m-p/2311374#M82421</link>
      <description>&lt;DIV class="votecell post-layout--left"&gt; 
 &lt;DIV class="js-voting-container grid fd-column ai-stretch gs4 fc-black-200"&gt; 
  &lt;DIV class="js-vote-count grid--cell fc-black-500 fs-title grid fd-column ai-center"&gt;
   Hello Everyone!
  &lt;/DIV&gt; 
  &lt;DIV class="js-favorite-count mt8"&gt;
   &amp;nbsp;
  &lt;/DIV&gt; 
 &lt;/DIV&gt; 
&lt;/DIV&gt; 
&lt;DIV class="postcell post-layout--right"&gt; 
 &lt;DIV class="post-text"&gt; 
  &lt;P&gt;I have been using Talend's Context variables for a while; however, I am now running into an issue as I have never used a variable with Date Datatype before. I have a field in the database called&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;my_date&amp;nbsp;&lt;/STRONG&gt;and it is in the format of&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;"DD-MON-YY"&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and I have created a context variable withe date datatype:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;context.CLOSING_MONTH&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and below is my query&lt;/P&gt; 
  &lt;PRE&gt;select  id,due_date

 from my_table

 where trunc(due_date) &amp;lt;  '"+context.CLOSING_MONTH+"' &lt;/PRE&gt; 
  &lt;P&gt;however, I have been getting the following error:&lt;/P&gt; 
  &lt;P&gt;&lt;STRONG&gt;java.sql.SQLDataException: ORA-01858: a non-numeric character was found where a numeric was expected&lt;/STRONG&gt;&lt;/P&gt; 
  &lt;P&gt;the value of context.CLOSING_MONTH is: 2019-07-01 00:00:00&lt;/P&gt; 
  &lt;P&gt;the odd thing is that if I remove the context variable and put its exact value (hard coding it) the error disappears.&lt;/P&gt; 
  &lt;P&gt;Your help is really appreciated!&lt;/P&gt; 
 &lt;/DIV&gt; 
&lt;/DIV&gt;</description>
      <pubDate>Sat, 16 Nov 2024 05:25:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Talend-Context-Variable-with-Date-DataType/m-p/2311374#M82421</guid>
      <dc:creator>DGFUser</dc:creator>
      <dc:date>2024-11-16T05:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: Talend Context Variable with Date DataType</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Talend-Context-Variable-with-Date-DataType/m-p/2311375#M82422</link>
      <description>&lt;P&gt;Just declare your context variable as a string variable then use the TO_DATE oracle function in your SQL query&lt;/P&gt;</description>
      <pubDate>Sun, 30 Jun 2019 11:40:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Talend-Context-Variable-with-Date-DataType/m-p/2311375#M82422</guid>
      <dc:creator>TRF</dc:creator>
      <dc:date>2019-06-30T11:40:45Z</dc:date>
    </item>
    <item>
      <title>Re: Talend Context Variable with Date DataType</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Talend-Context-Variable-with-Date-DataType/m-p/2311376#M82423</link>
      <description>&lt;P&gt;This is what I did; however, I am still getting the same error.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 30 Jun 2019 13:52:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Talend-Context-Variable-with-Date-DataType/m-p/2311376#M82423</guid>
      <dc:creator>DGFUser</dc:creator>
      <dc:date>2019-06-30T13:52:51Z</dc:date>
    </item>
    <item>
      <title>Re: Talend Context Variable with Date DataType</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Talend-Context-Variable-with-Date-DataType/m-p/2311377#M82424</link>
      <description>Can't see the TO_DATE function called in your initial query. Can you share it?</description>
      <pubDate>Sun, 30 Jun 2019 14:48:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Talend-Context-Variable-with-Date-DataType/m-p/2311377#M82424</guid>
      <dc:creator>TRF</dc:creator>
      <dc:date>2019-06-30T14:48:31Z</dc:date>
    </item>
    <item>
      <title>Re: Talend Context Variable with Date DataType</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Talend-Context-Variable-with-Date-DataType/m-p/2311378#M82425</link>
      <description>&lt;P&gt;The data type of the context variable CLOSING_MONTH is of Date type right?&lt;/P&gt;
&lt;P&gt;To use this value in your query you have to format the Date typed value into a compatible String for your query.&lt;/P&gt;
&lt;P&gt;You can do that with the routine TalendDate.&lt;/P&gt;
&lt;PRE&gt;select id, due_date
 from my_table
 where trunc(due_date) &amp;lt; '" + TalendDate.formatDate("yyyy-MM-dd", context.CLOSING_MONTH) + "'&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 30 Jun 2019 21:42:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Talend-Context-Variable-with-Date-DataType/m-p/2311378#M82425</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-06-30T21:42:17Z</dc:date>
    </item>
    <item>
      <title>Re: Talend Context Variable with Date DataType</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Talend-Context-Variable-with-Date-DataType/m-p/2311379#M82426</link>
      <description>&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt; 
&lt;P&gt;Thank you all for your responses. I believe I figured out what the issue is... It seems that if I write my query in the builder and click on OK Talends inserts '/' and my query looks like the following:&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;PRE&gt;select  id,due_date

 from my_table

 where trunc(due_date) &amp;lt;  '\"+context.CLOSING_MONTH+\"' &lt;/PRE&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;which causes the issue.. it is really odd that it is being added and thankfully I was able to spot it.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Thanks again as your help is really appreciated!&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2019 09:11:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Talend-Context-Variable-with-Date-DataType/m-p/2311379#M82426</guid>
      <dc:creator>DGFUser</dc:creator>
      <dc:date>2019-07-01T09:11:53Z</dc:date>
    </item>
    <item>
      <title>Re: Talend Context Variable with Date DataType</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Talend-Context-Variable-with-Date-DataType/m-p/2311380#M82427</link>
      <description>&lt;P&gt;I never use the SQL builder. I use SQL tools like DBeaver to create the queries and apply them in the component manually.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2019 09:29:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Talend-Context-Variable-with-Date-DataType/m-p/2311380#M82427</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-01T09:29:22Z</dc:date>
    </item>
  </channel>
</rss>

