Upload
welcometofacebook
View
102
Download
0
Embed Size (px)
DESCRIPTION
Citation preview
ISOM3260 Database Design and Administration
Lab 8: Oracle Reports Developer
Agenda
Oracle Project
Analysis, Design Implementation, Maintenance
Oracle Forms Developer SQL Tools
Oracle Reports Developer and integration
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
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
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
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
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')
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!
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)
Integrating Oracle Reports into Forms (2)
• Import Report into Oracle Forms
Integrating Oracle Reports into Forms (3)
• Import the Procedures– CALLREPORT– CALLCUSTOMIZEDREPORT– CALLCUSTOMIZEDREPORT2
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)>);
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)>);
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
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