oracle 日期比较 结果转换成小时 select to_date((日期字段1-日期字段2),"yyyy-mm-dd") * 24 但是现在万一时间格式不仅仅是yyyy-mm-dd 而且有hh24:mm:ss ,这个有转换成小时的好办法吗 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select trunc(sysdate - to_date('2010-7-7','yyyy-mm-dd')) 天,trunc((sysdate - to_date('2010-7-7','yyyy-mm-dd') -(trunc(sysdate - to_date('2010-7-7','yyyy-mm-dd')))) * 24) 时,trunc(((sysdate-to_date('2010-7-7','yyyy-mm-dd'))-trunc((sysdate-to_date('2010-7-7','yyyy-mm-dd')),2))*24*60) 分 from dual select (sysdate - to_date('2010-05-01 12:22:12','yyyy-mm-dd hh24:mi:ss')) * 24 from dual phoenix_99只看标题就回答了哦 如果时间格式是:yyyy-mm-dd hh24:mi:ss.那要看你是想要什么结果的小时了。1、如果想要真实的小时(带小数):select (sysdate - to_date('2010-07-01 00:00:00','yyyy-mm-dd hh24:mi:ss')) * 24 from dual;2、如果想要不带小数点的小时(小数四舍五入):select round((sysdate - to_date('2010-07-01 00:00:00','yyyy-mm-dd hh24:mi:ss')) * 24) from dual;2、如果想要不带小数点的小时(直接去掉小数):select trunc((sysdate - to_date('2010-07-01 00:00:00','yyyy-mm-dd hh24:mi:ss')) * 24) from dual; Oracle 10.2.0 实例经常自动断开,ora-00600.求救!!! Oracle 11g OEM 无法登陆 不同帐号连接oracle的速度差别很大是为什么? 动态行列转换,求指点 long raw!long raw! 谁能帮我写个RMAN备份恢复的例子,谢谢了! drop partition 的疑问 long raw ;如何在存储过程里 进行 insert? 在存储过程中如何创建临时表? ORACLE 8.0.5 客户端连接8.1.7的数据库服务器出错。 system用户无法创建程序包?按回车没有反应 大哥们,帮小弟写个存储过程。。
trunc((sysdate - to_date('2010-7-7','yyyy-mm-dd') -(trunc(sysdate - to_date('2010-7-7','yyyy-mm-dd')))) * 24) 时,
trunc(((sysdate-to_date('2010-7-7','yyyy-mm-dd'))-trunc((sysdate-to_date('2010-7-7','yyyy-mm-dd')),2))*24*60) 分
from dual
1、如果想要真实的小时(带小数):
select (sysdate - to_date('2010-07-01 00:00:00','yyyy-mm-dd hh24:mi:ss')) * 24 from dual;
2、如果想要不带小数点的小时(小数四舍五入):
select round((sysdate - to_date('2010-07-01 00:00:00','yyyy-mm-dd hh24:mi:ss')) * 24) from dual;
2、如果想要不带小数点的小时(直接去掉小数):
select trunc((sysdate - to_date('2010-07-01 00:00:00','yyyy-mm-dd hh24:mi:ss')) * 24) from dual;