Oracle 谓语前推导致的错误
Posted moredrinkhotwater
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Oracle 谓语前推导致的错误相关的知识,希望对你有一定的参考价值。
create table tab_zy_test1
(
id1 number,
date1 date,
date2 varchar2(100)
);
insert into tab_zy_test1 values (1, date ‘2018-01-01‘, ‘20180131‘);
insert into tab_zy_test1 values (2, date ‘2018-01-01‘, ‘20180228‘);
insert into tab_zy_test1
values
(2, date ‘2018-01-01‘, ‘2018/02/28 14:33:33‘);
insert into tab_zy_test1
values
(3, date ‘2018-02-01‘, ‘20180228 14:33:33‘);
commit;
insert into tab_zy_test1
values
(3, date ‘2018-02-01‘, ‘ ‘);
commit;
select *
from tab_zy_test1;
with tab_a as
(select t.id1,
t.date1,
t.date2,
row_number() over(partition by t.id1, t.date1 order by t.date2 desc) rw
from tab_zy_test1 t),
tab_b as
(select a.id1, a.date1, a.date2, a.rw from tab_a a where a.rw = 1),
tab_c as
(select b.id1, b.date1, to_date(substr(b.date2, 1, 8), ‘yyyy-mm-dd‘) date2
from tab_b b)
--select * from tab_c
,
tab_d as
(select c.date1 - c.date2 from tab_c c --where c.date1 - c.date2 < 0
)
select * from tab_d;
以上是关于Oracle 谓语前推导致的错误的主要内容,如果未能解决你的问题,请参考以下文章
调试 Oracle 批量 DML 错误 - 如何确定导致错误的值?
删除了数据文件导致导致oracle数据库未启动(错误提示:ora-01109)