Page 1 of 1

Assigning current date and time in the transformer

Posted: Wed Jul 28, 2004 6:25 pm
by Bhusan
How do I assign current timestamp into timestamp field in Oracle table? I am trying to do that in a transformer.

Thanks.

Posted: Wed Jul 28, 2004 6:35 pm
by rasi
Hi


Use the @TIME function in the transformation step. Datastage has time() / timedate() function which can also be used.

Make sure you change the time to the correct format to your oracle database.

Cheers
Siva

Posted: Wed Jul 28, 2004 7:47 pm
by chucksmith
Also, look at some of the marcos. I like to use the DataStage job start timestamp.

Re: Assigning current date and time in the transformer

Posted: Thu Jul 29, 2004 2:19 am
by peternolan9
Bhusan wrote:How do I assign current timestamp into timestamp field in Oracle table? I am trying to do that in a transformer.

Thanks.
Bhusan,
I put :

Ans = (OCONV(DATE(), "D4-YMD[4,2,2]") : " " : OCONV(TIME(), "MTS:"))

into a routine called GetSystemTimeStamp and then I call that function in my transformers.....

I did it this way because if we ever change databases the length of the timestamp string will be different. Oracle uses 19, SQL Server 23, Sybase IQ 23. Then I can just change one routine in one place.

By doing it this way I can move databases...also, I wrote a tool and published it on my web site www.peternolan.com that allows editting of DS XML....so if we ever move databases I can edit the properties of fields en-mass......

All,
Call me crazy, but I just don't think everyone should use oracle all the time for everything.. ;-)

And I think it is wise for any customer, when they negotiate support and upgrade fees with Oracle, to be able to tell Oracle that they can move the DW to any ODBC compliant database with minimal effort, and are willing do do so unless Oracle helps out on support/maintenance fees.....if you can't move, no discount, simple as that...;-)

Just my 2c worth...or, if we count my 2c + Oracle fees.....

My gazzillion dollar tip.. (LOL)...