sql server - SQL View: ORA Error -
i created view in ms sql. worked perfectly. when exported , imported project oracle environment, view didn't work anymore. far know, used meta sql.
hope can help!
select oprid , descr1 , descr , descr5 , descr6 , descr7 , year , weekofyear --when working more 6 hours, subtract .5 hours break , case when (convert(decimal(10,1) , datediff(minute , dg_monday_start , dg_monday_end))/60) >= 6 (convert(decimal(10,1) , datediff(minute , dg_monday_start , dg_monday_end))/60 - 0.5) else (convert(decimal(10,1) , datediff(minute , dg_monday_start , dg_monday_end))/60) end 'monday' , case when (convert(decimal(10,1) , datediff(minute , dg_tuesday_start , dg_tuesday_end))/60) >= 6 (convert(decimal(10,1) , datediff(minute , dg_tuesday_start , dg_tuesday_end))/60 - 0.5) else (convert(decimal(10,1) , datediff(minute , dg_tuesday_start , dg_tuesday_end))/60) end 'tuesday' , case when (convert(decimal(10,1) , datediff(minute , dg_wednesday_start , dg_wednesday_end))/60) >= 6 (convert(decimal(10,1) , datediff(minute , dg_wednesday_start , dg_wednesday_end))/60 - 0.5) else (convert(decimal(10,1) , datediff(minute , dg_wednesday_start , dg_wednesday_end))/60) end 'wednesday' , case when (convert(decimal(10,1) , datediff(minute , dg_thursday_start , dg_thursday_end))/60) >= 6 (convert(decimal(10,1) , datediff(minute , dg_thursday_start , dg_thursday_end))/60 - 0.5) else (convert(decimal(10,1) , datediff(minute , dg_thursday_start , dg_thursday_end))/60) end 'thursday' , case when(convert(decimal(10,1) , datediff(minute , dg_friday_start , dg_friday_end))/60) >= 6 (convert(decimal(10,1) , datediff(minute , dg_friday_start , dg_friday_end))/60 - 0.5) else (convert(decimal(10,1) , datediff(minute , dg_friday_start , dg_friday_end))/60) end 'friday' , '0' 'total' --total calculated in peoplecode ps_dg_bpv_roster year year(to_date(to_char(sysdate,'yyyy-mm-dd'),'yyyy-mm-dd')) , (dg_monday_start != dg_monday_end or dg_tuesday_start != dg_tuesday_end or dg_wednesday_start != dg_wednesday_end or dg_thursday_start != dg_thursday_end or dg_friday_start != dg_friday_end)
in query, use convert
command in oracle must use cast
.
the type decimal must changed number type follow.
instead of:
convert(decimal(10,1), field)
use:
cast(field number(10,1))
tell me if it's ok
edit after comment
in oracle sql server function datediff has been replaced -
sign, normal difference between 2 data field.
i advice site you'll find equivalent function between oracle 10g , sql server 2008r2
Comments
Post a Comment