所有的日期字段都為字符串報錯為expected char got number從報錯分析來看是類型不一樣,也就是*100不是數(shù)字值,但是第二段代碼卻過了,這就很不理解了,如果真的類型不一樣第二段*100也會報錯才對下面的這兩處為什么會有沖突select case ? when sysdate < to_date(cih.begin_year || '-' || cih.begin_month || '-01', 'yyyy-MM-dd') ? then '0.0' ? when cih2.time2<sysdate? then '100'? when ??????? cih2.time2-to_date(cih.begin_year || '-' || cih.begin_month || '-01', 'yyyy-MM-dd')=0? then '0.0'????--這里?
else (((to_date(cih.begin_year || '-' || cih.begin_month || '-01',
'yyyy-MM-dd')-sysdate)+1)/(cih2.time2-to_date(cih.begin_year || '-' ||
cih.begin_month || '-01', 'yyyy-MM-dd'))*100)??? --這里,報錯的地方這個100下面有下劃線end 項目總體進(jìn)度 ?from cbm_item_headers cih,(select a.*,(case ??????? when To_number(a.end_month, '99') < 12 ??????? then to_date(a.end_year || '-' || to_char(cih2.end_month2,'99') || '-01', 'yyyy-MM-dd') ??????? else to_date(to_char(cih2.end_year2,'9999') || '-' || '01' || '-01', 'yyyy-MM-dd') end) time2from cbm_item_headers a,(select
item_code,to_number(end_year, '9999') + 1
end_year2,to_number(end_month, '99')+1 end_month2 from cbm_item_headers)
cih2 where a.item_code=cih2.item_code) cih2where cih.item_code=cih2.item_code我去掉這兩處其中一處就可以運(yùn)行select(((to_date(cih.begin_year
|| '-' || cih.begin_month || '-01',
'yyyy-MM-dd')-sysdate)+1)/(cih2.time2-to_date(cih.begin_year || '-' ||
cih.begin_month || '-01', 'yyyy-MM-dd'))*100)????--去掉了case就可以運(yùn)行from cbm_item_headers cih,(select a.*,(case ??????? when To_number(a.end_month, '99') < 12 ??????? then to_date(a.end_year || '-' || to_char(cih2.end_month2,'99') || '-01', 'yyyy-MM-dd') ??????? else to_date(to_char(cih2.end_year2,'9999') || '-' || '01' || '-01', 'yyyy-MM-dd') end) time2from cbm_item_headers a,(select
item_code,to_number(end_year, '9999') + 1
end_year2,to_number(end_month, '99')+1 end_month2 from cbm_item_headers)
cih2 where a.item_code=cih2.item_code) cih2where cih.item_code=cih2.item_code----------------------------------------------------------select case ? when sysdate < to_date(cih.begin_year || '-' || cih.begin_month || '-01', 'yyyy-MM-dd') ? then '0.0' ? when cih2.time2<sysdate? then '100'? when ??????? cih2.time2-to_date(cih.begin_year || '-' || cih.begin_month || '-01', 'yyyy-MM-dd')=0? then '0.0'????????--去掉了else就可以運(yùn)行end 項目總體進(jìn)度 ?from cbm_item_headers cih,(select a.*,(case ??????? when To_number(a.end_month, '99') < 12 ??????? then to_date(a.end_year || '-' || to_char(cih2.end_month2,'99') || '-01', 'yyyy-MM-dd') ??????? else to_date(to_char(cih2.end_year2,'9999') || '-' || '01' || '-01', 'yyyy-MM-dd') end) time2from cbm_item_headers a,(select
item_code,to_number(end_year, '9999') + 1
end_year2,to_number(end_month, '99')+1 end_month2 from cbm_item_headers)
cih2 where a.item_code=cih2.item_code) cih2where cih.item_code=cih2.item_code
- 1 回答
- 0 關(guān)注
- 1075 瀏覽
添加回答
舉報
0/150
提交
取消