Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I want to create a Date type Global variable which I want to pass to a Child Job. I am able to pass String and Integer Type to Child One. But getting hard luck with Date type one's. Below is the code i am writing in my tjavarow. In the Child Job context variables passing this Global Variables value. and using those. Now in the Child Job toracleInput I have to use the 2 Date type Context where Global variable Value will be coming from Parent Job.
String fromdate_file_epsilon=input_row.START_DATE1;
globalMap.put("fromdate_file_epsilon", fromdate_file_epsilon);
String todate_file_epsilon = input_row.END_DATE1;
globalMap.put("todate_file_epsilon",todate_file_epsilon);
Date fromdate_epsilon = input_row.START_DATE;
globalMap.put("fromdate_epsilon", fromdate_epsilon);
Date todate_epsilon = input_row.END_DATE;
globalMap.put("todate_epsilon", todate_epsilon);
Integer load_key_epsilon = input_row.LOAD_KEY;
globalMap.put("load_key_epsilon", load_key_epsilon);
System.out.println(fromdate_epsilon);
HI,
I strongly recommend you to leave date context variables as string and to convert the values as Oracle datatype using the to_date function into the where clause like this:
... AND TRUNC(ACTIVITY_DATE) >= TO_DATE('" + context.FROMDATE + "', 'yyyy_mm-dd')" ...
date format is given here as an example.
HI,
I strongly recommend you to leave date context variables as string and to convert the values as Oracle datatype using the to_date function into the where clause like this:
... AND TRUNC(ACTIVITY_DATE) >= TO_DATE('" + context.FROMDATE + "', 'yyyy_mm-dd')" ...
date format is given here as an example.
Hi @TRF,
So you are suggesting me to pass the date type Variable to the Child Job as String? I have already created that type variable to be used in Child for creating File Output delimited. So My Query will be like this Select Column Names from Table where
TRUNC(ACTIVITY_DATE) between
TO_DATE('" + context.FROMDATE + "', 'MM/dd/yyyy') and
TO_DATE('" + context.TODATE + "', 'MM/dd/yyyy') where context.FROMDATE and context.TODATE will be String Type Context of my Child Job and will get value in String of Parent Job of Global Variable right?
Hi @TRF,
Your suggestion worked like charm as always. marking this post as resolved. Thanks a Lottttttttttt
You're welcome