SQLTeam.com | Weblogs | Forums

Oracle to SQL


#1

Hello,

Below is my simple query:

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?

Thank you SQL expert!


#2

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
)


#3

Hi bitsmed, I did try and still returning none decimal value..


#4

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
)


#5

I did that as well and still returning none decimal values as well.


#6

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
)


#7

Hi bitsmed, still returning none decimal value... :frowning:


#8

Then I'm out of ideas


#9

please paste a few (2-3) rows of the result set from the openquery call