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 26
Other forums
PHP MySQL Return Results Issue
Hi guys,
I'm running joomla and made a module which is using ajax.
Basically i just have a
Best way to read this text file.
Hi.I am planning to make a small application in C# to convert the players from Football manager 2010
Mysql query, two times?
Hello to all,
I'm new to php coding and i like it alot. I need help with some noob stuff.
b+ tree
Hi
can every body help me about b+ tree ?(insert & delete)
small inaccuracies
I have this code to convert fractional base 10 into base 2:
while($num > 0)
Not "Just Another" MMORPG - text based.
Hello,
I've been learning MySQL and PHP for the last 2-3 years.
Though, I've had long paus
How do I replace any number of character occurences with one occurrence?
How do I replace any number of character occurences with one occurrence?
Let's say I have:
calculator
I can't figure out why this code doesn't work. No error messages. Page loads.
Code: <
Generate PDF
Hi guys,
I would like to know if there is a way to generate pdf when clicking on a link. In f
How to refresh a parent page from a modal popup
Hi,I have a modal popup in which I need to upload a file and store in the database should give a mes