Insert Timestamp ("YYYY:MM:DD HH:MM:SS") in hashta

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
Jdrost
Participant
Posts: 17
Joined: Wed Jun 28, 2006 3:32 am

Insert Timestamp ("YYYY:MM:DD HH:MM:SS") in hashta

Post by Jdrost »

Hello,

I am having trouble inserting a record into a hashtable with a routine. This record contains a field TIMESTAMP. I get an error-message on the data-type of this field. This is the actual error-message:

DataStage/SQL: character and number types are incompatible in this operation
Scanned command was INSERT INTO ERROR_LOG_hash ( JOB_ID , ERROR_CODE , TIMESTAMP , TIME , PROCESS_ID , SOURCE_TABLE , TARGET_TABLE , SUBS_CODE , VALUE_KEY1 , VALUE_KEY2 , VALUE_KEY3 , VALUE_KEY4 , VALUE_KEY5 , VALUE_ID1 , VALUE_ID2 , VALUE_ID3 , VALUE_ID4 , VALUE_ID5 , VALUE_ERR_ATTR1 , VALUE_ERR_ATTR2 , VALUE_ERR_ATTR3 , ERROR_DESCRIPTION ) VALUES ( 9999 , 9009 , 2006-09-13 14:20:55
DataStage/SQL: Field "TIMESTAMP" data type does not match insert value.


The hashtable is created in another DS-job. TIMESTAMP is defined Timestamp 23-3. I have also tryed varchar but nothing works.

I use this statement to insert:
Command = 'INSERT INTO ERROR_LOG_hash (JOB_ID, ERROR_CODE, TIMESTAMP, TIME, PROCESS_ID, SOURCE_TABLE, TARGET_TABLE, SUBS_CODE, VALUE_KEY1, VALUE_KEY2, VALUE_KEY3, VALUE_KEY4, VALUE_KEY5, VALUE_ID1, VALUE_ID2, VALUE_ID3, VALUE_ID4, VALUE_ID5, VALUE_ERR_ATTR1, VALUE_ERR_ATTR2, VALUE_ERR_ATTR3, ERROR_DESCRIPTION) VALUES(':JobID:', ':ErrorCode:', ':Timestamp:', ':Time:', ':ProcessName:', ':SourceTable:', ':TargetTable:', ':SubsCode:', ':ValueKey1:', ':ValueKey2:', ':ValueKey3:', ':ValueKey4:', ':ValueKey5:', ':ValueID1:', ':ValueID2:', ':ValueID3:', ':ValueID4:', ':ValueID5:', ':ErrAttr1:', ':ErrAttr2:', ':ErrAttr3:', ':ErrorDescription:');'
Call DSExecute('TCL', Command, Output, Code)


Can someone help me to solve this problem?
Kind regards,

Johannes Drost
DeepakCorning
Premium Member
Premium Member
Posts: 503
Joined: Wed Jun 29, 2005 8:14 am

Re: Insert Timestamp ("YYYY:MM:DD HH:MM:SS") in ha

Post by DeepakCorning »

I m little confused..When you say HashTable do you mean hashed File or a DB table?? So Job1 loads a tables and the Job2 Loads the file??
Jdrost
Participant
Posts: 17
Joined: Wed Jun 28, 2006 3:32 am

Re: Insert Timestamp ("YYYY:MM:DD HH:MM:SS") in ha

Post by Jdrost »

DeepakCorning wrote:I m little confused..When you say HashTable do you mean hashed File or a DB table?? So Job1 loads a tables and the Job2 Loads the file??
I mean a hashed file.
Kind regards,

Johannes Drost
Mike
Premium Member
Premium Member
Posts: 1021
Joined: Sun Mar 03, 2002 6:01 pm
Location: Tampa, FL

Post by Mike »

A hashed file is also a UV table.

I have no experience with Universe SQL, but it does seem strange that the timestamp in your error message doesn't have any surrounding quote characters:
VALUES ( 9999 , 9009 , 2006-09-13 14:20:55
Mike
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

It is so much easier to make all the columns varchar on a hashed file. Deal with timestamps only when writing to a real table.
Mamu Kim
Jdrost
Participant
Posts: 17
Joined: Wed Jun 28, 2006 3:32 am

Post by Jdrost »

kduke wrote:It is so much easier to make all the columns varchar on a hashed file. Deal with timestamps only when writing to a real table.
I also tryed that. If it is defined as varchar then I get the following error-message:

DataStage/SQL: syntax error. Unexpected symbol. Token was "2006-08-21 14:30".
Scanned command was INSERT INTO ERROR_LOG_hash6 ( JOB_ID , ERROR_CODE , TIMESTAMP , TIME , PROCESS_ID , SOURCE_TABLE , TARGET_TABLE , SUBS_CODE , VALUE_KEY1 , VALUE_KEY2 , VALUE_KEY3 , VALUE_KEY4 , VALUE_KEY5 , VALUE_ID1 , VALUE_ID2 , VALUE_ID3 , VALUE_ID4 , VALUE_ID5 , VALUE_ERR_ATTR1 , VALUE_ERR_ATTR2 , VALUE_ERR_ATTR3 , ERROR_DESCRIPTION ) VALUES ( 9999 , 9009 , "2006-08-21 14:30"
Kind regards,

Johannes Drost
WoMaWil
Participant
Posts: 482
Joined: Thu Mar 13, 2003 7:17 am
Location: Amsterdam

Post by WoMaWil »

maybe that to mask or not to mask or to convert or not to convert is the hash files problem...

Try to change the field-names "TIMESTAMP" and "TIME " as fieldname make my stomach turn a bid.

Use "ErrorTimeStamp" and "ErrorTime" and tell if it helped.
Wolfgang Hürter
Amsterdam
Jdrost
Participant
Posts: 17
Joined: Wed Jun 28, 2006 3:32 am

Post by Jdrost »

WoMaWil wrote:maybe that to mask or not to mask or to convert or not to convert is the hash files problem...

Try to change the field-names "TIMESTAMP" and "TIME " as fieldname make my stomach turn a bid.

Use "ErrorTimeStamp" and "ErrorTime" and tell if it helped.
I have changed the field-names (correct remark), but I still get the same error-message. I tryed with and without double-quote " in the string.

Do I have to declare the field containing the timestamp as a string (if so, how do I do that?)?
Kind regards,

Johannes Drost
changming
Participant
Posts: 68
Joined: Wed Oct 13, 2004 3:35 am

use string

Post by changming »

I do not know how you insert timestamp into hashtable. I just did a test, wrtie timestamp as string into hash file, the field data type is timestamp. There is no problem at all. the timestamp I am using is like this, yyyymmddhhmmss, for exsample 20060606124731
bhaskarjha
Participant
Posts: 67
Joined: Thu Apr 06, 2006 7:13 am

Post by bhaskarjha »

Hi,
Try using this
VALUES ( 9999 , 9009 , "2006-08-21 14:30:00.000000").
Bhaskar Jha
Jdrost
Participant
Posts: 17
Joined: Wed Jun 28, 2006 3:32 am

Re: use string

Post by Jdrost »

changming wrote:I do not know how you insert timestamp into hashtable. I just did a test, wrtie timestamp as string into hash file, the field data type is timestamp. There is no problem at all. the timestamp I am using is like this, yyyymmddhhmmss, for exsample 20060606124731
Can you send me the code of this test, because I tryed it and it wouldn't work. Do you declare the timestamp-variable in the routine as string (how?) or do you just assign a alphanumeric value to it?
Kind regards,

Johannes Drost
Jdrost
Participant
Posts: 17
Joined: Wed Jun 28, 2006 3:32 am

Post by Jdrost »

bhaskarjha wrote:Hi,
Try using this
VALUES ( 9999 , 9009 , "2006-08-21 14:30:00.000000").
When I include the double-quotes I get an error-message stating that a unvalid token was found. Without the double-quotes it still states a syntax-error......
Kind regards,

Johannes Drost
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Hashed files do not support the TimeStamp data type. Prefer VarChar with a precision at least as large as you need (19, 23, 26 or more). You will need to enclose the value in single quotes.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply