BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
AaronPK__
Calcite | Level 5

Hello,

 

I am trying to load data from a SAS Data set to an Oracle table. All the fields expect data date fields are inserted with no problems at all.

 

One of my date fields is character in SAS dataset and is of datetime format. The other date field is ddmmyy8., In the first case, a blank value is inserted into Oracle table and for the second field 01-JAN-60 is being inserted into Oracle table.

 

DateMapping.png

Why doesn't SAS DI not comply with Oracle Date field types? Has anyone faced this problem before? Is this a known buy?

 

Any ideas??

 

Thanks!

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
AaronPK__
Calcite | Level 5

Thanks for the help fellas, I was able to fix the problem by setting format to DATETIME22.

 

Cheers,

Aaron

View solution in original post

3 REPLIES 3
SASKiwi
PROC Star

Oracle date columns are actually datetimes, so you should have more success if you define your SAS DI date columns as datetime columns  (numeric with the DATETIME20. format applied). Here is a useful link that describes how Oracle data types are translated:

 

http://support.sas.com/documentation/cdl/en/acreldb/69580/HTML/default/viewer.htm#p06jk0u30uhuj5n18f...

 

IMO the issue here is more a case of not assigning the right format to the date(time) columns to be loaded rather than SAS DI not "complying" with Oracle Smiley Happy

Patrick
Opal | Level 21

@AaronPK__

For the character field: Convert it to a SAS Date or DateTime column in SAS before you load it into Oracle.

For the SAS Date field: Use format DATE9. for SAS Date values and DATETIME21. for SAS datetime values. For some reasons the SAS/Access engine doesn't play nicely with all OOTB SAS Date and DateTime formats but I know from experience that conversion is working with formats Date and Datetime.

 

If you don't want to change the formats then you can also use option DBTYPE to control how values from SAS columns get converted to values for DBMS columns. http://support.sas.com/documentation/cdl/en/acreldb/63647/HTML/default/viewer.htm#a001371576.htm 

 

AaronPK__
Calcite | Level 5

Thanks for the help fellas, I was able to fix the problem by setting format to DATETIME22.

 

Cheers,

Aaron

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1541 views
  • 2 likes
  • 3 in conversation