DBMS_MAX_STRING_SIZE Package
The DBMS_MAX_STRING_SIZE package provides an interface for checking and changing the value of the DBMS_MAX_STRING_SIZE initialization parameter.
CHECK_MAX_STRING_SIZE Function
This function checks if the MAX_STRING_SIZE parameter can be updated to a given value and returns a list of violations that would prevent the parameter from being updated.
Syntax
DBMS_MAX_STRING_SIZE.CHECK_MAX_STRING_SIZE(
new_value IN VARCHAR2)
RETURN DBMS_MAX_STRING_SIZE_TBL;
Parameters
| Parameter | Description |
|---|---|
new_value |
Specifies the new MAX_STRING_SIZE parameter value to be set. The only valid value is:'STANDARD’ . |
Usage Notes
If the return list is empty, then there are no violations and the MAX_STRING_SIZE update can be performed.
Example
SELECT * FROM TABLE(DBMS_MAX_STRING_SIZE.CHECK_MAX_STRING_SIZE('STANDARD'));
TYPE OBJECT_OWNER OBJECT_NAME COLUMN_NAME REASON
------ ------------ ----------- -------------- ---------------------------------------------
COLUMN ADMIN SALES CUST_NOTES Physical column exceeds STANDARD length limit
1 rows selected.
MODIFY_MAX_STRING_SIZE Procedure
This procedure updates the value of the MAX_STRING_SIZE parameter to a given value.
Syntax
DBMS_MAX_STRING_SIZE.MODIFY_MAX_STRING_SIZE(
new_value IN VARCHAR2);
Where: user_account is the user account name (schema name).
Parameters
| Parameter | Description |
|---|---|
new_value |
Specifies the new MAX_STRING_SIZE parameter value to be set. The only valid value is: 'STANDARD'. |
Usage Notes
-
Using
DBMS_MAX_STRING_SIZE.MODIFY_MAX_STRING_SIZEis a one-way change that cannot be reverted. After a database is switched back to theSTANDARDstyle of supporting a maximum length of 4000 bytes for theVARCHAR2,NVARCHAR2, andRAWdata types, you cannot re-enableEXTENDEDdata types. -
The ADMIN user is granted
EXECUTEprivilegeWITH GRANT OPTIONclause onDBMS_MAX_STRING_SIZE. Oracle recommends that you do notGRANT EXECUTEon this package to other users. -
The error
ORA-20000is raised if any object exists that would preventMAX_STRING_SIZEfrom being updated. -
The ADMIN user is granted
EXECUTEprivilegeWITH GRANT OPTIONclause onDBMS_MAX_STRING_SIZE. Oracle recommends that you do notGRANT EXECUTEon this package to other users.
Example
SELECT NAME, VALUE FROM V$PARAMETER WHERE NAME = 'max_string_size';
NAME VALUE
max_string_size EXTENDED
BEGIN
DBMS_MAX_STRING_SIZE.MODIFY_MAX_STRING_SIZE('STANDARD');
END;
/
PL/SQL procedure successfully completed.
SELECT NAME, VALUE FROM V$PARAMETER WHERE NAME = 'max_string_size';
NAME VALUE
max_string_size STANDARD