SRW.MESSAGE
built-in procedureThis procedure displays a message with the message number and text that you specify. The message is displayed in the format below. After the message is raised and you accept it, the report execution will continue.
MSG-msg_number: msg_text.
This procedure can be used to:
write custom messages to the trace file along with any Oracle Reports error
messages (the message specified by SRW.MESSAGE
is written to
the trace file when TRACEOPTS
=
TRACE_ALL
or TRACE_ERR
).
debug a report in Reports Builder.
SRW.MESSAGE(msg_number NUMBER, msg_text CHAR);
Parameters |
Description |
|
Is a number from one to ten digits, to be displayed on the message line. Numbers
less than five digits will be padded with zeros out to five digits. For
example, if you specify 123, it will be displayed as |
|
Is at most 190 minus the |
You cannot trap nor change Reports Builder error messages.
SRW.MESSAGE
does not terminate the report execution; if you
want to terminate a report after raising a message, use SRW.PROGRAM_ABORT
.
Any extra spaces in the message string will be displayed in the message; extra spaces are not removed by Reports Builder.
The scenarios described below illustrate how SRW.MESSAGE
behaves
in Reports Builder (rwbuilder
) (for debugging) vs. Reports Runtime
(rwrun
) vs. a report executing in the Reports Server (rwserver
).
Note: You must enable tracing by specifying
tracing options to generate messages specified by SRW.MESSAGE
.
Scenario 1
In this scenario, SRW.MESSAGE
is used in PL/SQL exception handling
and raises SRW.PROGRAM_ABORT
.
Activity |
SRW.MESSAGE Behavior |
Reports Builder (rwbuilder ) |
|
Run to Paper Design view | Specified SRW.MESSAGE is raised in Message dialog
box with msg_number , msg_text , and
OK button. |
Generate to File (File![]() |
Specified SRW.MESSAGE is raised in Message dialog
box with msg_number , msg_text , and
OK button. |
Reports Runtime (rwrun ) |
|
Tracing is not specified, or TRACEOPTS
is set to values other than TRACE_ALL or TRACE_ERR . |
Specified SRW.MESSAGE and log is written to
reports.log , along with the relevant REP error message. |
TRACEOPTS =
TRACE_ALL or TRACE_ERR |
Specified SRW.MESSAGE is written to reports.log ,
along with the relevant REP error message. Specified SRW.MESSAGE is also written to trace file, along
with the relevant REP error message. |
Reports Server (rwserver ) |
|
Tracing is not specified, or TRACEOPTS
is set to values other than TRACE_ALL or TRACE_ERR . |
Specified SRW.MESSAGE is displayed in browser
window, along with the relevant REP error message. |
TRACEOPTS =
TRACE_ALL or TRACE_ERR |
Specified SRW.MESSAGE is displayed in browser
window, along with the relevant REP error message.Specified SRW.MESSAGE is also written to trace file, along
with the relevant REP error message. |
In this scenario, SRW.MESSAGE
is used to raise invalid/special
values or conditions.
Activity |
SRW.MESSAGE Behavior |
Reports Builder (rwbuilder ) |
|
Run to Paper Design view | Specified SRW.MESSAGE is raised in Message dialog
box with msg_number , msg_text , and
OK button. Output is shown in Paper Design view. |
Generate to File (File![]() |
Specified SRW.MESSAGE is not displayed, but is
written to trace file if tracing is specified. |
Reports Runtime (rwrun ) |
|
Tracing is not specified, or TRACEOPTS
is set to values other than TRACE_ALL or TRACE_ERR . |
Report output is generated. |
TRACEOPTS =
TRACE_ALL or TRACE_ERR |
Report output is generated. Specified SRW.MESSAGE is written to trace file, along with
the relevant REP error message. |
Reports Server (rwserver with
rwservlet ) |
|
Tracing is not specified, or TRACEOPTS
is set to values other than TRACE_ALL or TRACE_ERR . |
Report output is generated. |
TRACEOPTS =
TRACE_ALL or TRACE_ERR |
Output is generated. Specified SRW.MESSAGE is written to trace file, along with
the relevant REP error message. |
If you used SRW.MESSAGE
in a report built with Oracle Reports
6i for a client/server environment, the following tips will help you
modify your report for a Reports Server environment (Oracle9i Reports
onwards).
Client/server environment (6i) |
Reports Server environment (9i onwards) |
SRW.MESSAGE was used to indicate a condition
that was not very common, but not unexpected. |
The report output could/should contain conditional formatting text that will achieve the same effect. |
SRW.MESSAGE was used to indicate a rare but handled
condition with the expectation of giving users an opportunity to manually
kill the process if they did not want to continue. |
The reports should be modified to have a parameter that forces continued
execution; otherwise, For example, the report is run only if new orders have been received above $1,000,000. The user can pass this value of 1,000,000 as a user parameter, and the report will not be executed based on this value. |
SRW.MESSAGE was used to indicate what condition
caused SRW.PROGRAM_ABORT to be called. |
Specify TRACEFILE
and TRACEOPTS =
TRACE_ALL or TRACE_ERR . |
Example 1: Suppose you have to do a bonus calculation based on salary. The bonus is a placeholder column. To do so, you could write the following formula:
function foo return boolean is
begin
if :sal < 0 then
SRW.MESSAGE(100, 'Found a negative salary. Check
the EMP table.');
raise SRW.PROGRAM_ABORT;
else
:bonus := :sal * .01;
end if;
return(true);
end;
If a negative salary is found, Reports Builder will raise the message. Reports Server and Runtime will write the message into trace file.
Example 2: Suppose there is an image file for every employee, stored on the file system. A report has to be created, showing the correct image for each employee record:
function f return varchar2 IS
a Text_IO.File_Type;
ret varchar2(200);
begin
begin
a := Text_IO.Fopen(rtrim(:ename)||'.gif', 'r');
Text_IO.Fclose(a);
ret := rtrim(:ename)||'.gif';
exception
when others THEN
srw.message(1,'FILE NOT FOUND');
end;
return(ret);
end;
If the file open or close operation fails, then the message 'FILE NOT
FOUND'
displays in Reports Builder, or is written to the trace file in
Reports Runtime or Server.
About the
Reports Builder built-in package (SRW
)
Copyright © 1984, 2005, Oracle. All rights reserved.