select case 
           when '2012-01-06' is not null and '1'='1'
                and ('2012-01-06' is null or CalInteval(to_date('SeriousDiagnoseDate', 'yyyy-mm-dd'),to_date('DieDate', 'yyyy-mm-dd'))>28)
                then case 
                         when
                              ((366>0  and 366<=365) or
                               (calInteval(to_date('2011-01-06', 'yyyy-mm-dd'),to_date('2012-01-06', 'yyyy-mm-dd'))>0 and
                                calInteval(to_date('2011-01-06', 'yyyy-mm-dd'),to_date('2012-01-06', 'yyyy-mm-dd'))<=365))
                          then 0
                          else 30000.0
                     end
           else 0 
       end 
from dual

最终形成的sql 就是这样,放在plsql里执行,报错,怎么回事?


1个回答

to_date('SeriousDiagnoseDate', 'yyyy-mm-dd')这里面SeriousDiagnoseDate不是日期

CalInteval(to_date('SeriousDiagnoseDate', 'yyyy-mm-dd'),to_date('DieDate', 'yyyy-mm-dd'))>28)这行里面SeriousDiagnoseDate和DieDate都不是有效日期