Use the restriction toggle to determine whether messages for errors numbers that are legitimate Oracle error numbers will be retrieved from the PLVmsg PL/SQL table (unrestricted) or from the SQLERRM function (restricted). A legitimate Oracle error number is an integer that is negative or zero or 100 (equivalent to -1403 or "no data found").
The restriction toggle is composed of three programs:
PROCEDURE restrict; PROCEDURE norestrict; FUNCTION restricting RETURN BOOLEAN;
If you call norestrict, PLVmsg will first check the PL/SQL table of PLVmsg to see if there is an error message for that error. In unrestricted mode, therefore, you can automatically substitute standard Oracle error messages with your own text -- and be as selective as you like about the substitutions.
Here are examples of the toggle in use:
In a SQL*Plus script, direct all error messages to be retrieved from the PL/SQL table, if present.
At the start of a SQL*Plus session, make sure that Oracle messages will be used whenever possible.
SQL> exec PLVmsg.restrict;
Copyright (c) 2000 O'Reilly & Associates. All rights reserved.