Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 

 


Using The SQL MODEL Clause To Generate Financial Statements
August 1, 2005
Mark Rittman

One of our clients that I worked at recently had a rather tricky report that they wanted me to help with. At present, the report was put together using Excel, and looked something like this:

The report consisted of two sections, the top section being the actual, budget and variance figures for a department, and the bottom section being a set of percentages based on the top section. The first line of the report, net sales, was a memorandum item detailing the net sales for the department. The next two lines, gross profit and other income were then added together by a spreadsheet formula to give the next line, total net income. Next, wage costs, rent costs and other costs were totalled to give total costs, with the figure for total costs then being subtracted from total net income to give net contribution. The percentages at the bottom of the report were then calculated using these figures. Finally, variances were calculated, again using an Excel formula, for each of the line items.

As well as producing a report for each department, the client also wanted to produce another copy, this time for the company as a whole and derived from the figures in the department level reports. The figures in the top half of the report would need to be summed, whilst the percentages in the bottom half would need to be averaged.

The client had tried to produce the report using Discoverer and an account hierarchy, but the figures wouldn't add up properly. Fundamentally, you can't (easily) produce this sort of report in a tool like Discoverer because of all the inter-row calculations that are going on - the figures for row 4 are the sum of row 2 and 3, the figures for row 12 are the sum of rows 5 to 7 divided by row 1, and so on. Now they could write some PL/SQL code that would load the data into a PL/SQL collection and then process each figure individually, but a thought that came to mind when we were discussing it was to try out the new SQL MODEL clause.


 

 
��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster
 
 
 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2017

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.

Remote Emergency Support provided by Conversational