select *
from openquery (district,' select invoiceid,
case when custcode = 'red' then round(invoiceid/5,1) else 0 end as invoice2
from oradb
)
oradb is oracle table in oracle database
In Oracle side, I am returning decimal value but in sql I am not returning decimal value. How do I update this simple query to fix this issue so I can return the value in decimal as well?
Try this:
select *
from openquery (district,' select invoiceid,
round(case when custcode = 'red' then invoiceid/5 else 0.0 end,1) as invoice2
from oradb
)
How about this:
select *
from openquery (district,' select invoiceid,
round(case when custcode = 'red' then invoiceid/5.0 else 0.0 end,1) as invoice2
from oradb
)
select *
from openquery (district,' select invoiceid,
round(case when custcode = 'red' then cast(invoiceid as decimal(18,1))/5.0 else 0.0 end,1) as invoice2
from oradb
)