Cast ile veri tipinin değiştirilmesi örnek olarak aşağıdaki sorguyu inceleyebilirsiniz.
Sorgunun test edilmesi için ise http://192.168.1.200:8090/odata2/@64/DQCast_Sorgu_Kodu_Degistirmeyin veri tiplerini kontrol edebilirsiniz.
select
cari.reference as CARI_REF
,cari.code as CARI_KOD
,cari.description as CARI_ACIKLAMA
,ypb_top.postedNet as bakiye
,abs(ypb_top.postedNet) as BAKIYE
,case when ypb_top.postedNet > 0 then ypb_top.postedNet
when ypb_top.postedNet < 0 then (ypb_top.postedNet * -1.0) else cast(1 as java.math.BigDecimal) end as B_A -- BigDecimal e cast edilir
,( ypb_top.postedNet / ypb_top.postedNet) as BOLME
,ypb_top.postedNet + 0.1 as sayi
,cast(cari.creationTime as java.sql.Date) as CAST_TARIH
,cast(cari.creationTime as java.util.Date) as CAST_TARIH_2
,cast(cari.reference as java.lang.String) as CARI_REF_STRING -- String e cast edilir
,cast(ypb_top.postedNet + 0.1 as java.lang.Integer) as cast_integer -- int32 ye cast edilir
,cast((ypb_top.postedNet + 0.1) as java.math.BigDecimal) as cast_bigdecimal -- BigDecimal e cast edilir
,cast((ypb_top.postedNet + 0.1) as java.lang.Long) as cast_long -- Long (int64) cast edilir
,kurum.code
from FinParty cari
left join cari.periodLTotal ypb_top
left join cari.entity kurum
where cari.entity.reference = 1 --:entity_reference
--and ypb_top.postedNet <0
--and OrFilter a = ypb_top.postedNet
order by cari.code