将SAS日期值(mmddyy10.)插入到Oracle表中。

huangapple go评论65阅读模式
英文:

Inserting the SAS date value (mmddyy10.) to Oracle table

问题

I have a requirement where i need to insert date(mmddyy10.) from a dataset into the oracle table column(Date type). After executing the proc sql insert as shown below date inserted in oracle table are showing as '01/Jan/1960&#39'

Sample :
oracle table : Test
column : close_date
date type : date

SAS data set: Test1
column : close_date
data type: mmddyy10.

proc sql; insert into test (close_date) select close_date from test1; quit;
Please let me know how to handle this issue.

我需要将数据集中的日期(mmddyy10.格式)插入到 Oracle 表的日期列中。在执行如下所示的 PROC SQL 插入后,插入到 Oracle 表中的日期显示为 '01/Jan/1960'。

示例:
Oracle 表:Test
列:close_date
日期类型:date

SAS 数据集:Test1
列:close_date
数据类型:mmddyy10.

proc sql; insert into test (close_date) select close_date from test1; quit;
请告诉我如何处理这个问题。

英文:

I have a requirement where i need to insert date(mmddyy10.) from a dataset into the oracle table column(Date type). After executing the proc sql insert as shown below date inserted in oracle table are showing as '01/Jan/1960'
Sample :
oracle table : Test
column : close_date
date type : date

SAS data set: Test1
column : close_date
data type: mmddyy10.

    proc sql;
    insert into test (close_date) select close_date from test1;
    quit;

Please let me know how to handle this issue

答案1

得分: 0

尝试插入与您的日期相对应的日期时间

... DHMS(closedate,0,0,0) ...

尽管1960年1月1日也是SAS日期纪元的日期(即SAS日期是一个数字,表示自1960年1月1日以来的天数),所以您的数据集中可能会有一个0。

英文:

Try inserting datetime corresponding to your date

... DHMS(closedate,0,0,0) ...

Although 01-jan-1960 is also the date of SAS date epoch (i.e. a SAS date is a number. Then number of days since 01-jan-1960). So, you might have a 0 in your data set.

huangapple
  • 本文由 发表于 2023年4月6日 19:52:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/75949204.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定