Oracle 使用 SQLLDR 进行日期减法
我正在尝试将 NetBackup 统计信息导入 Oracle。我真正想要的一个字段是 ACTIVE START,但它无法从 bpdbjobs -report 中获得。可用的是 ACTIVEELAPSED,所以我想从导入时的 END TIME 中减去它,如下所示:
END TIME 格式:26/09/2009 10:46:20 PM
ELAPSED TIME 格式:028:32:35(即小时,分钟、秒)
SQL*Loader 控制文件(相关行):
ACTIVE_ELAPSED BOUNDFILLER POSITION(261:270),
END_TIME POSITION(271:293) char "to_date(:End_time, 'dd/mm/yyyy hh:mi:ss AM')",
ACTIVE_START EXPRESSION "to_date(:END_TIME, 'dd/mm/yyyy hh:mi:ss AM') - TO_DSINTERVAL(':ACTIVE_ELAPSED')",
我的谷歌搜索告诉我,间隔没有格式掩码,所以我目前很困惑(Oracle SQL 不是我的正常工作!)
乔纳森
I am trying to import NetBackup statistics into Oracle. One field I really want is ACTIVE START, but it isn't available from bpdbjobs -report. What is available is ACTIVEELAPSED, so I want to subtract that from the END TIME on import as follows:
END TIME Format: 26/09/2009 10:46:20 PM
ELAPSED TIME Format: 028:32:35 (which is hours, minutes, seconds)
SQL*Loader Control File (Relevant lines):
ACTIVE_ELAPSED BOUNDFILLER POSITION(261:270),
END_TIME POSITION(271:293) char "to_date(:End_time, 'dd/mm/yyyy hh:mi:ss AM')",
ACTIVE_START EXPRESSION "to_date(:END_TIME, 'dd/mm/yyyy hh:mi:ss AM') - TO_DSINTERVAL(':ACTIVE_ELAPSED')",
My googling informs me that there are no format masks for Interval, so I am currently stumped (Oracle SQL is not my normal gig!)
Jonathan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以分割经过的时间并将其转换为天数,然后您可以从 END_TIME 中减去它:
you could split the elapsed time and convert it in (fraction of) days, then you can substract it from END_TIME: