Using Variable Substitution in Validation Actions

You can use variable substitution in validation actions to write dynamic validations that provide a result based on the values of input and output parameters of a procedure or function, or on the return value of a function. You can specify strings in the following format in validation actions:

What is actually substituted is the string representation of the parameter value (for text substitution), or the underlying data value of the parameter (for bind substitution, using the syntax :param-name). The following example shows both styles of substitution (text style and bind style):

DECLARE
    l_PARAM1 DATE;
    bad_date EXCEPTION;
BEGIN
    l_PARAM1 := :PARAM1;
    IF '{PARAM1}' <> TO_CHAR(l_PARAM1)
    THEN
        RAISE bad_date;
    END IF;
END;

As a simple example of text-style variable substitution:

You can use variable substitution for all types of validation actions except Compare Tables. For the applicable validation action types, variable substitution is performed as follows: