Oracle® Database PL/SQL Packages and Types Reference 10g Release 2 (10.2) Part Number B14258-02 |
|
|
PDF · Mobi · ePub |
UTL_LMS
retrieves and formats error messages in different languages.
This chapter contains the following topics:
Security Model
This section contains topics which relate to using the UTL_LMS
package.
This package must be created as the user SYS
.
Table 172-1 UTL_LMS Package Subprograms
Function | Description |
---|---|
Formats a retrieved error message |
|
Retrieves an error message based on error number, product, facility, language, and message specified |
This function formats a message retrieved by the GET_MESSAGE
function and returns the formatted message. If the function fails, then it returns a NULL
result.
The following table shows special characters that can be used in the format string.
Special Character | Description |
---|---|
'%s' |
Substitute the next string argument |
'%d' |
Substitute the next integer argument |
'%%' |
Represents the special character % |
UTL_LMS.FORMAT_MESSAGE ( format IN VARCHAR2 CHARACTER SET ANY_CS, args IN VARCHAR2 CHARACTER SET ANY_CS DEFAULT NULL) RETURN VARCHAR2 CHARACTER SET format%CHARSET;
Table 172-2 FORMAT_MESSAGE Procedure Parameters
Parameter | Description |
---|---|
|
Specifies the string to format |
|
Specifies the list of arguments |
DECLARE s varchar2(200); i pls_integer; BEGIN i:= utl_lms.get_messsage(26052, 'rdbms', 'ora', 'french', s); dbms_output.put_line('before format, message is: '||s); dbms_output.put_line('formatted message is: '||utl_lms.format_message(s, 9, 'my_column_name'); END; /
The following is an unformatted message:
Type %d non pris en charge pour l'expression SQL sur la colonne %s.
The following is the formatted message:
Type 9 non pris en charge pour l'expression SQL sur la colonne my_column_name.
This function retrieves an Oracle error message. The user can define user-specific error messages with the lmsgen
utility.
It returns 0
when it is successful. It returns -1
when it fails.
UTL_LMS.GET_MESSAGE ( errnum IN PLS_INTEGER, product IN VARCHAR2, facility IN VARCHAR2, language IN VARCHAR2, message OUT NOCOPY VARCHAR2CHARCTER SET ANY_CS) RETURN PLS_INTEGER;
Table 172-3 GET_MESSAGE Function Parameters
Parameter | Description |
---|---|
|
Specifies the error number. Example: |
|
Specifies the product to which the error message applies Example: ' |
|
Specifies the error message prefix Example: |
|
Specifies the language of the message. The parameter is case-insensitive. The default is |
|
Specifies the output buffer for the retrieved message |
If the language
parameter is set to NULL
, then the value of the NLS_LANGUAGE
session parameter is used as the default.
DECLARE s varchar2(200); i pls_integer; BEGIN i:=utl_lms.get_message(601, 'rdbms', 'oci', 'french', s); dbms_output.put_line('OCI--00601 is: '||s); END /
The following output results:
OCI--00601 is: Echec du processus de nettoyage.