date is an integer

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
acool
Participant
Posts: 29
Joined: Tue Feb 17, 2004 4:31 pm

date is an integer

Post by acool »

Hi,

I try to put current date to Oracle. The Oracle type on the target table is Date. If I use the function Date(), then it is a 13310. But if I use the function Oconv, then it becomes blank on the target table.

I do I handle this.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Post your Oconv logic. I'd also suggest defining it as a Timestamp in the OCI stage and consistently handling them that way.
-craig

"You can never have too many knives" -- Logan Nine Fingers
1stpoint
Participant
Posts: 165
Joined: Thu Nov 13, 2003 2:10 pm
Contact:

Post by 1stpoint »

If your oracle target is OCI, the date needs to be in it's native format which in the generated SQL code will use a to_date conversion function.
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

The Oracle stage adds to_Date(columnname, 'YYYY-MM-DD') to your column in the auto-generated SQL. If you're using auto-generated SQL, then make sure your date value looks like YYYY-MM-DD. Using DATE() returns the internal date format, so use something like OCONV(@DATE, 'D-YMD[4,2,2]'). If you're using custom SQL, then you must insure that your date value gets the appropriate to_date logic to cast the DS supplied value into the form the database accepts.
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
acool
Participant
Posts: 29
Joined: Tue Feb 17, 2004 4:31 pm

doesn't work

Post by acool »

Hi Ken,

I tried your way, it doesn't work either.
Here is the error message:

Attempt to convert String value "2004-06-09" to Date type unsuccessful


kcbland wrote:The Oracle stage adds to_Date(columnname, 'YYYY-MM-DD') to your column in the auto-generated SQL. If you're using auto-generated SQL, then make sure your date value looks like YYYY-MM-DD. Using DATE() returns the internal date format, so use something like OCONV(@DATE, 'D-YMD[4,2,2]'). If you're using custom SQL, then you must insure that your date value gets the appropriate to_date logic to cast the DS supplied value into the form the database accepts.
ketfos
Participant
Posts: 562
Joined: Mon May 03, 2004 8:58 pm
Location: san francisco
Contact:

Post by ketfos »

Hi,
Try this
OCONV(@DATE, "D-YMD[4,2,2]")

1. @DATE system variable - The internal date when the program started
It return integer value.

2. When this is passed to OCONV it returns the date as 2004-06-09

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

Re: doesn't work

Post by kcbland »

acool wrote:Hi Ken,

I tried your way, it doesn't work either.
Here is the error message:

Attempt to convert String value "2004-06-09" to Date type unsuccessful


kcbland wrote:The Oracle stage adds to_Date(columnname, 'YYYY-MM-DD') to your column in the auto-generated SQL. If you're using auto-generated SQL, then make sure your date value looks like YYYY-MM-DD. Using DATE() returns the internal date format, so use something like OCONV(@DATE, 'D-YMD[4,2,2]'). If you're using custom SQL, then you must insure that your date value gets the appropriate to_date logic to cast the DS supplied value into the form the database accepts.
Well, are you using Auto-gen'd SQL or custom? If you're using custom, did you remember to put the to_date logic on the date column?
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
mandyli
Premium Member
Premium Member
Posts: 898
Joined: Wed May 26, 2004 10:45 pm
Location: Chicago

Post by mandyli »

Hi

Please try StringToTimestamp(date) or else use Timedate system function.
afssekar
Participant
Posts: 11
Joined: Fri Apr 23, 2004 10:24 am
Location: chennai

Post by afssekar »

Please use TimeDate( ) function...
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi,
AFAIK, when using the date data type in native stages the transformation from internal DS date repersentation should be transparent.
so if you have a number (DS internal date) it should work automatically.
I had this working once when moving dates from Informix to SQL Server,
I used the date data type when exctracting the date from IFX, with no transformation what so ever, and simply inserted to SQL Server with date data type (using OLE DB I think).
(I guess I need to check it on ORACEL :roll: )

IHTH,
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
acool
Participant
Posts: 29
Joined: Tue Feb 17, 2004 4:31 pm

Re: doesn't work

Post by acool »

I use custom SQL, with to_date.
kcbland wrote:
acool wrote:Hi Ken,

I tried your way, it doesn't work either.
Here is the error message:

Attempt to convert String value "2004-06-09" to Date type unsuccessful


kcbland wrote:The Oracle stage adds to_Date(columnname, 'YYYY-MM-DD') to your column in the auto-generated SQL. If you're using auto-generated SQL, then make sure your date value looks like YYYY-MM-DD. Using DATE() returns the internal date format, so use something like OCONV(@DATE, 'D-YMD[4,2,2]'). If you're using custom SQL, then you must insure that your date value gets the appropriate to_date logic to cast the DS supplied value into the form the database accepts.
Well, are you using Auto-gen'd SQL or custom? If you're using custom, did you remember to put the to_date logic on the date column?
Post Reply