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

How to kill asynchronous postback / current postback?
Hi,here is my problem:I have a web site with many pages of which some may take time to process resul

Google Wave
So... has anyone used it yet? Is it any good?

http://wave.google.com/help/wave/about.html#vid

Problem with an browser game.
Hello,i just joined that great forum and i got php prob,its kinda freaky...anyway i got browser game

Line break?
Hi, I'm new to the forum and new to php. I'm not sure if I'm using the correct terminology so here i

removing space from the end of a variable
i have a variable $image which contains the following url "http://tiles.xbox.com/tiles/oo/P5/0m

Simple code help with redirects
I am trying to figure out a redirect script that detects if the browser is IE 7 and if it does, redi

CHECH A STRING FOR ' " ' (DOUBLE QUOTES)
I am checking for delimiter (.!?) and if there is a " after a sentence then it should neglect a

Mysterious Timeouts
I've deployed a few simple AJAX-enabled web page to a local server that is accessed through the Inte

Website Direction...
I recently used this code to try and make it so the page loads as http://www.domain.com/ when you ty

Preg_match question
I want to use preg_match to make sure a string is always 6 characters long and only contains 0-9 and

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