15
ISOM3260 Database Design and Administration Lab 8: Oracle Reports Developer

Database reports generation(database)

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Database reports generation(database)

ISOM3260 Database Design and Administration

Lab 8: Oracle Reports Developer

Page 2: Database reports generation(database)

Agenda

Oracle Project

Analysis, Design Implementation, Maintenance

Oracle Forms Developer SQL Tools

Oracle Reports Developer and integration

Page 3: Database reports generation(database)

Oracle Reports Developer

• Generate reports base on SQL queries• Create Reports Developer files first. They are to be integrated to Oracle Forms 

Create reports using Reports 

Builder

Import the report files as objects in 

Forms Builder

Write triggers to call the 

report objects

Page 4: Database reports generation(database)

Types of Reports

• Managerial Reports without user inputs– Show Top 10 Customer/Brands/Products…etc

• Users just need to execute to print the reports

• Managerial Reports with user inputs– Show the sales of ‘a particular’ Customer, Product Brand..etc

• User have to specify the criteria before they print the reports

Page 5: Database reports generation(database)

Illustration 1: Show Top 5 high‐paid staff 

• SQL Code:SELECT * FROM (

SELECT staff_no, last_name, first_name, salary, ROWNUM rnFROM (SELECT staff_no, last_name, first_name, salary 

FROM staff ORDER BY salary  DESC))WHERE RN<=5

ORSELECT staff_no, last_name, first_name, salary, ROWNUM rn

FROM (SELECT staff_no, last_name, first_name, salary FROM staff ORDER BY salary  DESC)

WHERE ROWNUM<=5

Page 6: Database reports generation(database)

Illustration 2: Show and count the number of staff by Birthday Month

• SQL Code:SELECT staff_no, last_name, first_name, to_char(sta_dob,'DD‐MM‐YYYY'), to_char(sta_dob,'MM') FROM staff ORDER BY to_char(sta_dob,'MM')

• Use the Group‐by Function by Reports Developer, instead of grouping it using SQL

Page 7: Database reports generation(database)

Illustration 3: Display the staff who are younger than the date specified

• SQL Code:SELECT sta_staff_no, sta_last_name,sta_first_name, to_char(sta_dob,'DD‐MM‐YYYY') FROM staff WHERE sta_dob > To_Date(:DATE_TO_QUERY,'DD‐MM‐YYYY')

Page 8: Database reports generation(database)

Save the reports

• Save it as <report name>.jsp• One jsp file contains one report

– i.e. There are 10 jsp files for 10 reports

• For integration into Oracle Forms• The file path should have NO SPACE!

Page 9: Database reports generation(database)

Integrating Oracle Reports into Forms (1)

• Check the following pre‐requisites– The paths of JSP reports do not contain any spaces

– JSP reports must be located in folders with “Write and Read” permission (C:\temp in LSKG021, LSKG005)

Page 10: Database reports generation(database)

Integrating Oracle Reports into Forms (2)

• Import Report into Oracle Forms

Page 11: Database reports generation(database)

Integrating Oracle Reports into Forms (3)

• Import the Procedures– CALLREPORT– CALLCUSTOMIZEDREPORT– CALLCUSTOMIZEDREPORT2

Page 12: Database reports generation(database)

Integrating Oracle Reports into Forms (4)

• Create a trigger with codes– Reports without variables

• CALLREPORT(‘<REPORT NAME>’, ‘<REPORT SERVER>’);

– Reports with 1 variable• CALLCREPORT(‘<REPORT NAME>’, ‘<REPORT SERVER>’,’<VARIABLE DEFINED IN REPORTS BUILDER>’,<TEXTBOX LOCATION (NO SINGLE‐QUOTE)>);

Page 13: Database reports generation(database)

Integrating Oracle Reports into Forms (5)

– Reports with 2 variables• CALLCREPORT2(‘<REPORT NAME>’, ‘<REPORT SERVER>’,’<VARIABLE1 DEFINED IN REPORTS BUILDER>’,<TEXTBOX LOCATION OF VARIABLE1 (NO SINGLE‐QUOTE)>, ’<VARIABLE2 DEFINED IN REPORTS BUILDER>’, <TEXTBOX LOCATION OF VARIABLE2(NO SINGLE‐QUOTE)>);

Page 14: Database reports generation(database)

Integrating Oracle Reports into Forms (5)

• Start Reports Server– In Command Prompt (cmd)

• rwserver server=<Unique Name, eg. Stu_ID>

• Start Runtime in Oracle Forms 

Page 15: Database reports generation(database)

Summary

• Oracle Reports Developer as a tool to generate managerial reports base on SQL queries

• Integrate the reports into Oracle Forms

• Call the reports using a trigger