We all know that Oracle reports is a tool for Oracle Data Statistics and graphical reports. Oracle reports provides six different report formats, but we often use tabular and matrix, the following articles will introduce you.
Regardless of the report type, the number of printed tables changes dynamically. In a tabular report, the number of columns is fixed, but the number of rows is not fixed. In a matrix Report, the number of rows and the number of columns are not fixed. In Oracle reports, how does one set the report length and width? In the actual development process, I have summarized an effective method for the above two types of reports for your reference.
For tabular reports, you can use reports to trigger sub-after parameter form and after report to achieve fixed-length output. The method is to determine the number of rows printed on each page according to the actual situation. When the number of records on the last page is less than the number of rows printed on each page, fill in the blank record. Insert an empty record in the trigger sub-after parameter form and delete the empty record in the trigger sub-after report. The following is an example.
Assume that there is a data base table wzdm: storing the material code information. Its data structure is:
Field name meaning length type
Wzdm material code 9 c
Wzmc material name 20 c
Xhgg model specification 20 c
Jldw measurement unit 6 c
Requirement: output the material code table based on the specified length, and x rows are output on each page (x can be determined based on the actual situation ).
1. Start Oracle reports, create a material code print report (omitted), and add the following code to the report trigger subitem after parameter form:
- declare
- v—jls number(2);
- i number(2):=1;
- begin
- select count() into v—jls from wzdm;
- if mod(v—jls,x)〈〉0 then
- loop
- exit when i〉=(x-mod(v—jls,x))+1;
- insert into wzdm(wzdm,wzmc,xhgg,jldw)
- values(′′,′′,′′,′′);
- ii:=i+1;
- end loop;
- commit;
- end if;
- end;
-
Add the following code to the report trigger subafter report:
- begin
- delete from wzdm where wzdm is null;
- commit;
- end;
2. After running the report, you can output the fixed-length material code table.
Note: For other tabular reports, when writing the above two triggers, you only need to modify the base table name and column name based on the actual situation and determine the value of x.
The above content is the introduction of Oracle reports to Oracle's data statistics and graphical reporting tools. I hope you will get some benefits.