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

An odd assignment statement. Can someone explain this assignment to me?
What purpose is served by the bit of code between the two equal signs in the $installurl set? Is th

Adding meta tags under Zend FW
Hello there, recently has come to my hands the FTP of a website which is running under Zend, I would

Issues: PHP Forms -Clearing
I've tried looking online before actually asking for help, but I've been looking for about the past

Filtering Tables
Hello Thanks for any help any one can give Im very new to PHP..

I need to pull data for clien

ctype() validation - allowing illegal characters
Hello,
I use ctype() to filter and validate a user form. However, I am trying to allow certain c

The page should be expire when cilck back button
hi,
i'm new to php world.
i create user registration page.
when i submit it,data goes to my

PayPal Redirect Issue
When I have my paypal button set so that is redirects to http://empiremarketing.ca/order.php,it work

Undefined variable when using $_SERVER['PHP_SELF']
Hi guyz, please suggest me something...
On first.php I have one input field NAME, and on posting

Get content from table into a list, without repeating.
Alright this is kinda an odd thing, so I need some help.

I have a table "quote" wit

A Few Questions
Hi, I want to ask a few questions that I can't seem to find..

1) I'm creating a "shortcu

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