有一个视图:vw_table
create or replace view vw_table as
select t.*,to_number(to_date(p.end_date,'yyyy-mm-dd')-to_date(to_char(sysdate,'yyyy-mm-dd'),'yyyy-mm-dd')) balanceDate
from t,p
where t.en_id=p.en_id
order by p.glo_id desc然后写sql语句:
select * from vw_table t where t.balanceDate=363总提示说:指定月份的日期无效不知道为什么?应该怎么解决呢?
create or replace view vw_table as
select t.*,to_number(to_date(p.end_date,'yyyy-mm-dd')-to_date(to_char(sysdate,'yyyy-mm-dd'),'yyyy-mm-dd')) balanceDate
from t,p
where t.en_id=p.en_id
order by p.glo_id desc然后写sql语句:
select * from vw_table t where t.balanceDate=363总提示说:指定月份的日期无效不知道为什么?应该怎么解决呢?
select t.*,(to_date(p.end_date,'yyyy-mm-dd')-sysdate) balanceDate
from t,p
where t.en_id=p.en_id
order by p.glo_id desc
你的指定月份无效可能是P.END_DATE里面的值的问题.它是字符型的吗???