how to give Default value for a date Target column.In

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
devaraj4u
Participant
Posts: 32
Joined: Mon Nov 11, 2002 12:32 am
Location: Schaumburg,Chicago

how to give Default value for a date Target column.In

Post by devaraj4u »

Hi All,

Could you please help me how to give Default value for a date Target column.In Oracle we can give sysdate right.Like wise I am asking.I assigned OCONV(@Date,"D2") to that column but is it giving the following Error message.

SQLSTATE=22008, DBMS.CODE=0
[DataStage][SQL Client][ODBC][Oracle][ODBC]Datetime field overflow.

What I need to do????
Please tell me the steps how to go about it.

Thanks & Regards,
K.S.Rajan.

(Moderator had to put missing DS release and OS to update topic, FYI they are unknown)
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Do you have a Support contract? Keep in mind the fact that Ascential's support is not only for the occasional bug report, but that they are more than happy to help with the "How in the heck do I do this?" kind of question. IMHO, their support has been great when I've thrown things like that at them.

That being said, if your are trying to default a date to the current sydate when it is null, a couple of things come to mind. If your source is Oracle, use NVL in your original query. In DataStage, test for null and then substitute in the system date. Check out things like the TimeDate() function, if you need a full timestamp or Date() for the current date. In your example you probably need to further qualify the conversion, something more like:

Oconv(Date(), "D4/MDY") to get MM/DD/YYYY for example

but I'd need to know the format that the ODBC stage is expecting the date to arrive in, which also depends on what data type you've defined the field as.

-craig
devaraj4u
Participant
Posts: 32
Joined: Mon Nov 11, 2002 12:32 am
Location: Schaumburg,Chicago

Post by devaraj4u »

Hi,

I tried with the following Default format 'YYYY-MM-DD HH24:MI:SS' and assigned a value to the TimeStamp Target filed it worked.

Thanks for your help,
K.S.Rajan.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

No problem. That's the default format for an OCI Timestamp field as well.

BTW, this is all documented in the .pdf files on the server cdrom for each of the plugin stages. Well worth your time to snag a copy of them and check them out.

-craig
Triton46
Charter Member
Charter Member
Posts: 83
Joined: Fri Feb 07, 2003 8:30 am

Post by Triton46 »

You're trying to put a large column into a small column. You must go into the transform and change the value.

IE:

DB Column = Varchar(30)
DS Column = Varchar(10)
Post Reply