Code.GeekInterview.com
  I am new, Sign me up!
 
Code Samples Oracle
 

Report Generator


Code ResourceAuthor: SriramKrishna  

Difficulty Level:

Published: 10th Jun 2007   Read: 1856 times  

Filed in: Oracle
Add Comment


 


SQL program given below generates a simple sales report for a year with date, page number displayed at top of report. The SQL program given should be saved in a file named as sample.sql extension and when this file is executed it generates report.

 


Sample Code
  1.  
  2.  rem SQL program TO generate sales report FOR a YEAR
  3. SET headsep:
  4. ttitle 'Sales Report For the Year 2000'
  5. COLUMN Item heading 'Item Sold'
  6. COLUMN Item format a18
  7. COLUMN Item trucated
  8. COLUMN PerTo heading 'Sold To' format a18 word_wrapped
  9. COLUMN Rate format 90.99
  10. COLUMN ADate heading 'Date'
  11. COLUMN QuanType heading 'Type' format a8 truncated
  12. COLUMN Quantity heading 'Quant' format 9990
  13. COLUMN Ext format 990.99
  14. break ON Item skip3
  15. compute SUM OF Ext ON Item
  16. SET linesize 79
  17. SET pagesize 50
  18. SET newpage 0
  19. spool sample.1st
  20. SELECT ADate,PerTo,Item,Quantity,QuanType,Rate,Quantity*Rate "Rup" FROM acct WHERE TYPE='SOLD'
  21. AND ADate BETWEEN To-DATE('01-JAN-2000','DD-MON-YYYY') AND To-DATE('31-DEC-2000','DD-MON-YYYY') ORDER BY Item,ADate;
  22. spool off
  23.  
Copyright GeekInterview.com


Next Article: Database Health check


 

Latest Code Samples

 

Popular Code Samples

 

Related Code Samples

 

Post Comment


Members Please Login

Name:  Email: (Optional. Used for Notification)

Title:
 
Comment:
Validation Code: <=>  (Enter this code in text box)





Popular Coders

# Coder NameHits
1. jamesravid16273
2. Jim.Anderson8828
3. krishnaindia20078132
4. Mohit Sharma6752
5. Beena5371
6. jainsourabh24063
7. SriramKrishna1857
8. Satheesh1778

Active Coders

Refined Tags

 

Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact  

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape