request with date of day

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
incognico
Participant
Posts: 23
Joined: Thu Sep 07, 2006 3:07 am

request with date of day

Post by incognico »

hello!!

i want to compare a field and the date of the day ni datastage 7.01PX

so my request is

select * from #TA_DWH_FT_ECRITURE# where id_cdf like 'K%' and to_char(dt_saisie,'dd/mm/yyyy')=#DATE_JOUR#
dt_saisie is in a date format.

DATE_JOUR is a parameter of this job: Oconv(Date(), "D4/DMY")

it's not ok, i have an error
how can i make this request ?

Thank's

Nick
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

What is the error that you are getting?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Then, quite simply, the value of the DATE_JOUR must also be in the same format. You will also need to convert both to date or both to string if necessary so that the comparison will be valid.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
incognico
Participant
Posts: 23
Joined: Thu Sep 07, 2006 3:07 am

Post by incognico »

yeah i know but how ?

Could you give me my request with the good syntax ?
Thank's

Nick
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Check if dt_saisie has data for current data and for the given condition.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
incognico
Participant
Posts: 23
Joined: Thu Sep 07, 2006 3:07 am

Post by incognico »

dt_saisie : 28/09/2005 format Date under Oracle
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

If you got any error, pls provide the same.
If you are getting any outpout, check if dt_saisie consit any data with todays date (system date) value. As that is what you are checking for.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
incognico
Participant
Posts: 23
Joined: Thu Sep 07, 2006 3:07 am

Post by incognico »

so my question is:

How can i have the date of the current day on this format : 16/10/2006

Thanks.

Nick

:D
incognico
Participant
Posts: 23
Joined: Thu Sep 07, 2006 3:07 am

Post by incognico »

so my question is:

How can i have the date of the current day on this format : 16/10/2006

Thanks.

Nick

:D
jhmckeever
Premium Member
Premium Member
Posts: 301
Joined: Thu Jul 14, 2005 10:27 am
Location: Melbourne, Australia
Contact:

Post by jhmckeever »

X = OCONV(DATE(), "D/E")
X = "16/10/2006"
<b>John McKeever</b>
Data Migrators
<b><a href="https://www.mettleci.com">MettleCI</a> - DevOps for DataStage</b>
<a href="http://www.datamigrators.com/"><img src="https://www.datamigrators.com/assets/im ... l.png"></a>
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Unofortunately, this is a PX job and OCONV() is not available.
jhmckeever
Premium Member
Premium Member
Posts: 301
Joined: Thu Jul 14, 2005 10:27 am
Location: Melbourne, Australia
Contact:

Post by jhmckeever »

Whoops - Sorry ... Still learning to read ... :?

How about:

MonthDayFromDate(CurrentDate()) : "/" :
MonthFromDate(CurrentDate()) : "/" :
YearFromDate(CurrentDate())

J.
<b>John McKeever</b>
Data Migrators
<b><a href="https://www.mettleci.com">MettleCI</a> - DevOps for DataStage</b>
<a href="http://www.datamigrators.com/"><img src="https://www.datamigrators.com/assets/im ... l.png"></a>
incognico
Participant
Posts: 23
Joined: Thu Sep 07, 2006 3:07 am

Post by incognico »

My result :

query is: select * from dwh.ta_dwh_ft_ecriture where id_cdf like 'K%' and to_char(dt_saisie,'dd/mm/yyyy')=MonthDayFromDate(CurrentDate()) : "/" : MonthFromDate(CurrentDate()) : "/" : YearFromDate(CurrentDate())
sqlcode is: -933
esql complaint: ORA-00933: la commande SQL ne se termine pas correctement

:?
jhmckeever
Premium Member
Premium Member
Posts: 301
Joined: Thu Jul 14, 2005 10:27 am
Location: Melbourne, Australia
Contact:

Post by jhmckeever »

incognico,

Sorry - I misunderstood the intent of your original post. I thought you wanted to perform the comparison in DataStage. You can't submit the XXXFromDate() functions to Oracle as these are DataStage functions. The Oracle equivalent is:

Code: Select all

to_char(sysdate,'dd/mm/yyyy')
If you want to always compare against the current date (on the Oracle server's clock) you can avoid having to pass the date as a parameter by using:

Code: Select all

select * from #TA_DWH_FT_ECRITURE# where id_cdf like 'K%' and to_char(dt_saisie,'dd/mm/yyyy')=to_char(sysdate,'dd/mm/yyyy')
J.
<b>John McKeever</b>
Data Migrators
<b><a href="https://www.mettleci.com">MettleCI</a> - DevOps for DataStage</b>
<a href="http://www.datamigrators.com/"><img src="https://www.datamigrators.com/assets/im ... l.png"></a>
Post Reply