Casting Decimals in Oracle


Posted on 16th Feb 2014 07:03 pm by admin

This code worked as a query in DB2, but I am not sure what the syntax is for casting decimals in Oracle:

decimal(decimal(A.record_count-A.generic_count-A.unusable_count,10,2) / decimal(B.record_count,10,2) * 100,10,2) usable_percent

The full query is:

SELECT B.load_date,
B.dsrc_id,
C.dsrc_code,
A.table_seq,
A.table_name,
A.record_type,
B.record_count total_records,
A.record_count,
A.generic_count,
A.unusable_count,
A.record_count-A.generic_count-A.unusable_count usable_count,
decimal(decimal(A.record_count-A.generic_count-A.unusable_count,10,2) / decimal(B.record_count,10,2) * 100,10,2) usable_percent
FROM (select load_id, table_seq, table_name, record_type,sum(record_count) record_count, sum(generic_count) generic_count, sum(unusable_count) unusable_count
from umf_sum_quality group by load_id, table_seq, table_name, record_type) A,
(select load_id, dsrc_id, load_date, sum(record_count) record_count
from umf_load_sum group by load_id, dsrc_id, load_date) B,
dsrc_code C
WHERE B.load_id = A.load_id and C.dsrc_id = B.dsrc_id
ORDER BY B.load_date desc, B.dsrc_id, A.table_seq, A.table_name, A.record_type

No comments posted yet

Your Answer:

Login to answer
98 Like 26 Dislike
Previous forums Next forums
Other forums

Validating time
Hi Guys

what do you think of the following approach to validate a 24hour time:

http://

PHP mail() with images
I'm trying to get images to send along with my HTML e-mail sent through PHP mail(). I only tried vie

This must be easy , pulling the last record of the day, every day, from a txt
I have a txt file logging weather data every minutes (so 1 record per minute). I want to extract the

contact form - output to page and email
I have the following in my controller:

$message['name'] = htmlentities(strip_tags(trim($_POST

how to get sn motherboard
Hello.
I want to get serial number motherboard, cpu and else hardware.
Can You show me sam

Xml parsing
I need a suggestion about parsing xml with multiply parts like pervious...
i.e. different device

change text color with a jQuery code
Hihow can I change the text in a asp:TextBox to a different color when I start typing using jQuery?I

What's best way to get a user's Word doc converted to simple html and images?
Hi all,

I was just wondering if anybody has any experience of this.
Basically, I'm buildin

User input in to variable
Hi all,

I'm sure this is very easy but I'm having another brain freeze!

At the end of

Why use interfaces in PHP (OOP)
I am learning OOP in PHP and its been a pretty good learning experience so far. What I didn't unders

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash