DATA Step, Macro, Functions and more

Problem while loading sas date into oracle

Reply
Occasional Contributor
Posts: 15

Problem while loading sas date into oracle

Hi,

I have a dataset which has one column which has a format ddmmyy .
when I am trying to copy to oracle it is creating a problem.

Please let me know to which format I should change this field so that oracle support.

Please if with any example would be great.

Thanks.
Super Contributor
Posts: 578

Re: Problem while loading sas date into oracle

In our installation, oracle dates show up as sas datetimes. We have to use the dhms function to create a true datetime prior to loading to oracle or the results is strange.

proc sql;
insert into oracle.table(dtvar)
select dhms(datevar,0,0,0) from sas.table;
quit;
Contributor
Posts: 63

Re: Problem while loading sas date into oracle

More than two years later, this fixed my problem.. no matter what I was doing the date was coming out 1/1/1960.  SAS 9.1.3 (yes, still) and Oracle 11g.  Thanks for posting!

Frequent Contributor
Posts: 90

Re: Problem while loading sas date into oracle

Hi bentleyj1,

still i am facing that issue.While loading from flat file to oracle database,i am getting the date column as 01-Jan-1960.

How to overcome tis issue.?I am using  SAS DI 4.21
Pls help

Super Contributor
Posts: 297

Re: Problem while loading sas date into oracle

Are you using the OLEDB or Oracle client to connect to Oracle?

I worked for a company that refused to purchase the Oracle client and we were forced to use OLEDB instead.  It did some really strange things with dates that took quite a bit of work and research to get around.  It might be worth investigating this further.

Regards,

Scott

Frequent Contributor
Posts: 90

Re: Problem while loading sas date into oracle

Scott,

I am using Oracle client.....Is ther any way to do this?

Super Contributor
Posts: 297

Re: Problem while loading sas date into oracle

Can you please provide a sample of the code you are using and the log output?

Super Contributor
Posts: 578

Re: Problem while loading sas date into oracle

How have you defined the data in the flat file?

Frequent Contributor
Posts: 90

Re: Problem while loading sas date into oracle

Bailey,

I hv defined the column as character datatype(not numeric).

Frequent Contributor
Posts: 90

Re: Problem while loading sas date into oracle

dhms(date_column,0,0,0) is working fine......

Thanks to all of you for ur support.

Thanks DBaily for the exp.

Contributor
Posts: 63

Re: Problem while loading sas date into oracle

I am not using DI studio so cannot comment on your particular issue other than to say perhaps you need to use a code window.  The code provided by DBaily on March 31st, 2011 solved my problem.

Valued Guide
Posts: 2,175

Re: Problem while loading sas date into oracle

is it possible to alter the default in SAS/ACCESS, like date <--> datetime

Super User
Posts: 3,105

Re: Problem while loading sas date into oracle

I suggest you try writing out to the flat file for loading into Oracle, dates in the form dd-mon-yyyy (01-Jan-2013). This, I believe, is one of the date formats that Oracle should handle automatically, assuming it is being loaded into a date column.

Ask a Question
Discussion stats
  • 12 replies
  • 3545 views
  • 1 like
  • 7 in conversation