37.4 DB_OPERATION_ALLOWED Function

This function checks whether a database operation is allowed (contained in the allowed operations) and either raises an APEX error or returns an error message.

Syntax

APEX_PLUGIN_UTIL.DB_OPERATION_ALLOWED (
    p_allowed_operations   IN VARCHAR2,
    p_operation            IN apex_plugin.t_db_operation,
    p_raise_error          IN BOOLEAN DEFAULT TRUE )
RETURN VARCHAR2;

Parameters

Table 37-5 DB_OPERATION_ALLOWED Parameters

Parameter Description
p_allowed_operations Allowed operations (U, UD, D).
p_operation Operation to check for.
p_raise_error Whether to raise an error if the operation is not allowed (default TRUE).

Returns

NULL if the operation is allowed.

If not allowed, an error message and p_raise_error is FALSE.

Example

The following example asserts (using allowed_operations_column) that the current operation is allowed within the Plug-In code. See above examples for illustration of the Plug-In DML procedure.

apex_plugin_util.db_operation_allowed (
DECLARE
    l_error_message varchar2(32767);
BEGIN
    l_error_message := apex_plugin_util.db_operation_allowed(
                         p_allowed_operations => apex_exec.get_varchar2(
                                                   p_context     => l_refetch_context,
                                                   p_column_name => p_params.allowed_operations_column ),
                         p_operation          => apex_plugin.c_db_operation_update,
                         p_raise_error        => false );
END;