以下查询成功:
SELECT INTERVAL '00:00:00.000000' HOUR TO SECOND(6)
FROM DUAL;
以下失败:
SELECT INTERVAL time_field HOUR TO SECOND(6) -- time_field is a VARCHAR2(15)
FROM some_table;
带有以下错误:
ORA-00923: FROM keyword not found where expected
如何修复我的第二个查询以拉回 HOUR TO SECOND INTERVAL?
当我尝试:
SELECT cast(time_field AS INTERVAL HOUR TO SECOND(6))
FROM some_table
我得到以下信息:
ORA-00963: unsupported interval type
测试设置:
CREATE TABLE some_table (
time_field VARCHAR2(50)
);
INSERT ALL
INTO some_table (time_field) VALUES ('10:00:00.000000')
INTO some_table (time_field) VALUES ('12:00:00.000000')
INTO some_table (time_field) VALUES ('15:00:00.000000')
INTO some_table (time_field) VALUES ('17:00:00.000000')
INTO some_table (time_field) VALUES ('20:00:00.000000')
INTO some_table (time_field) VALUES (NULL)
SELECT * FROM DUAL;