time_created 和 time_ended 是 VARCHAR 字段。
SQL 语句
SELECT time_created,
time_ended,
TO_TIMESTAMP (time_ended, 'YYYY/MM/DD-HH24:MI:SS:FF9')
- TO_TIMESTAMP (time_created, 'YYYY/MM/DD-HH24:MI:SS:FF9')
FROM trans
输出
2012/10/28-18:46:13.855 2012/10/28-18:47:43.357 +00 00:01:29.502000
2012/10/20-22:40:10.363 2012/10/20-22:40:35.265 +00 00:00:24.902000
2012/10/20-22:40:08.951 2012/10/20-22:40:24.717 +00 00:00:15.766000
2012/10/20-22:40:09.454 2012/10/20-22:40:28.217 +00 00:00:18.763000
2012/10/20-22:40:09.912 2012/10/20-22:40:31.767 +00 00:00:21.855000
2012/10/22-10:11:29.360 2012/10/22-10:14:08.692 +00 00:02:39.332000
2012/10/22-10:11:08.335 2012/10/22-10:11:43.781 +00 00:00:35.446000
2012/10/20-22:40:07.900 2012/10/20-22:40:17.508 +00 00:00:09.608000
2012/10/20-22:40:08.469 2012/10/20-22:40:21.144 +00 00:00:12.675000
2012/10/22-11:00:42.355 2012/10/22-11:01:41.706 +00 00:00:59.351000
2012/10/22-10:11:09.268 2012/10/22-10:11:54.185 +00 00:00:44.917000
2012/10/22-10:11:13.072 2012/10/22-10:12:21.365 +00 00:01:08.293000
我希望 where 子句只显示大于 1 分钟的记录。
我在 Sun Solaris 上使用 Oracle 数据库 10g。