Timestamp datatype

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
ketfos
Participant
Posts: 562
Joined: Mon May 03, 2004 8:58 pm
Location: san francisco
Contact:

Timestamp datatype

Post by ketfos »

Hi,

I have source and target Oracle tables. Both tables have field DeleteTime as datatype Timestamp(6).

How do I populate the target table so that I get the complete date as timestamp(6) i.e 2003-03-26-2.48.07.270954

Thks

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

Post by ray.wurlod »

Easy. You supply a timestamp with microseconds.
There are no inherent data types in server jobs, so you can construct it as a string, and use an appropriate date picture for the TO_DATE function in the INSERT statement.
It's up to you where you get the microseconds from.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Are you using the OCI stage with a 9i or 10g database? If so, the generated SQL should work fine.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
ketfos
Participant
Posts: 562
Joined: Mon May 03, 2004 8:58 pm
Location: san francisco
Contact:

Post by ketfos »

Hi,

I am using ORacle 9i with user defined sql
and use following to transform the date field in my sql statement.

insert into datefield values
TO_timestamp(:7, 'YYYY-MM-DD HH24:MI:SS:FF'),

I get following warning message follwoed by error message

Stagenametest is not supported for pre-defined update action.


Stagenametest : ORA-01036: illegal variable name/number

Thks

Ketfos
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

It appears you are not passing a properly formatted timestamp string as well as your user-defined SQL does not mask to 6 decimal places.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
ketfos
Participant
Posts: 562
Joined: Mon May 03, 2004 8:58 pm
Location: san francisco
Contact:

Post by ketfos »

Hi,

What is the meaning of the warning message -

not supported for pre-defined update action.


Thks

Ketfos
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

If this is your DML:

Code: Select all

insert into datefield values 
TO_timestamp(:7, 'YYYY-MM-DD HH24:MI:SS:FF'), 
then you have a trailing comma
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
ketfos
Participant
Posts: 562
Joined: Mon May 03, 2004 8:58 pm
Location: san francisco
Contact:

Post by ketfos »

Hi,

No there is no trailing comma as shown below

VALUES (:1,:2,:3,:4,:5,:6,
TO_timestamp(:7, 'YYYY-MM-DD HH24:MI:SS:FF'),
TO_DATE(:8, 'YYYY-MM-DD HH24:MI:SS'),
:9,
TO_DATE(:10, 'YYYY-MM-DD HH24:MI:SS'),
TO_DATE(:11, 'YYYY-MM-DD HH24:MI:SS'),
:12,:13,:14,:15,
TO_DATE(:16, 'YYYY-MM-DD HH24:MI:SS'));

ketfos
Post Reply