Validation trigger
Validation triggers are PL/SQL functions that are executed when parameter values
are specified on the command line and when you accept the Runtime Parameter
Form. (Notice that this means each validation trigger may fire twice when
you execute the report.) Validation triggers are also used to validate
the Initial Value property of the parameter. The function must return a boolean
value (TRUE or FALSE). Depending on whether the function returns TRUE
or FALSE, the user is returned to the Runtime Parameter Form. You can access
validation triggers from the Object Navigator, the PL/SQL Editor, or the Property
Inspector (Validation Trigger property).
Definition Level |
Parameter |
On Failure |
The user is returned to the parameter value
in the Runtime Parameter Form where they can either change it or cancel
the Runtime Parameter Form. |
Restrictions
- The PL/SQL in a validation trigger can be a maximum
of 32K characters. The upward limit may vary between operating systems.
- In a validation trigger, you can read and assign
values to Reports Builder parameters. You cannot read or assign values
to columns. For example, you can use the value of a parameter called COUNT1
in a condition (for example, IF :COUNT1 = 10) and you can directly set its value
in an assignment statement (for example, :COUNT1 = 15). In some cases, though,
the Validation Trigger may fire more than once for the same parameter.
As a result, it is usually best to assign parameter values in the After
Parameter Form trigger. Note also that the use of PL/SQL global variables
to indirectly set the values of columns is not supported. If you do this,
you may get unpredictable results.
- You should not use DDL in Validation triggers.
- For reports that are spawned processes of other
reports (for example, run with BACKGROUND=YES), you should commit database changes
you make in the Before Parameter Form, After Parameter Form, and Validation
triggers before the report runs. Spawned processes use their parent process'
database connection for the Before Parameter Form, After Parameter Form,
and Validation triggers. When the spawned process runs the report, though,
it establishes its own database connection. Any database changes not committed
by the time the child report runs will therefore be lost.
Examples
This function prevents the runtime user from sending report output anywhere
except a printer. The user will be returned to the Runtime Parameter Form unless
PRINTER is specified as the destination type (DESTYPE).
function DESTYPEValidTrigger return boolean is
begin
IF UPPER(:DESTYPE) = 'PRINTER' THEN
RETURN(TRUE);
ELSE
RETURN(FALSE);
END IF;
end;
See also
About triggers
About validation
triggers
Validating
a parameter value at runtime
Copyright © 1984, 2005, Oracle. All rights reserved.