Illegal date/time value warning

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
datskosaraju
Premium Member
Premium Member
Posts: 48
Joined: Tue Nov 25, 2008 11:10 pm
Location: Des Moines,IA

Illegal date/time value warning

Post by datskosaraju »

Hi all,

I am trying to insert some data into table(mysql database) using odbc stage.

Code: Select all

  sequential stage ------->TX--------->ODBC

One of the columns in the table is nullable with date as a datatype. The input for the date is a char in the input file. I am using oconv to convert that to date and assigning a default NULL for null values. The inserts for non nullable values from the input are going on fine, but for null values I am getting the below error

SQL statement:INSERT INTO table (USER_ID, MIDDLENAME, FIRSTNAME, LASTNAME, ZIPCODE, DATE, TITLE, GENDER, MIGRATION_TIMESTAMP, UPDATED) VALUES (?,?,?,?,?,?,?,?,?,?)
SQLSTATE=22008, DBMS.CODE=0
[DataStage][SQL Client]Illegal date/time value

USER_ID = 12345
MIDDLENAME = ""
FIRSTNAME = "XXXXX"
LASTNAME = "XXX"
ZIPCODE = "123456"
DATE = NULL
TITLE = ""
GENDER = "UNKNOWN"
MIGRATION_TIMESTAMP = "2010-09-23 19:49:13"
UPDATED = "2010-09-23 19:49:13"

FYI :I am able to execute the same query with the same values with success using sql tool.

Did anyone face this issue?
I am posting this only after searching the dsxchange.com extensively.
"It's easier to go down a hill than up it but the view is much better at the top"
-Bennet,Arnold
kris007
Charter Member
Charter Member
Posts: 1102
Joined: Tue Jan 24, 2006 5:38 pm
Location: Riverside, RI

Post by kris007 »

What function are you using to set the NULL value?
Kris

Where's the "Any" key?-Homer Simpson
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Is the DATE column nullable in the target?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
datskosaraju
Premium Member
Premium Member
Posts: 48
Joined: Tue Nov 25, 2008 11:10 pm
Location: Des Moines,IA

Post by datskosaraju »

@kris I am just hard coding the value 'NULL'

@Ray - Yes the date is Nullable in the database.
"It's easier to go down a hill than up it but the view is much better at the top"
-Bennet,Arnold
datskosaraju
Premium Member
Premium Member
Posts: 48
Joined: Tue Nov 25, 2008 11:10 pm
Location: Des Moines,IA

Post by datskosaraju »

I found a workaround for this.

Instead of using OConv to convert the incoming string to date and passing it on to the target, I am just passing on the without converting and doing the conversion before the inserting in to the target( the user defined sql (str_to_date("?", "%m%d%Y")).


will wait for the responses and mark it as resolved since this is just a workaround :D
"It's easier to go down a hill than up it but the view is much better at the top"
-Bennet,Arnold
Post Reply