Tuesday, June 9, 2015

Oracle VARCHAR2's length is BYTE or CHAR?

Oracle VARCHAR2's length is BYTE or CHAR?

It depends on an option you used when creating a column as follows:

VARCHAR2(20 BYTE)

VARCHAR2(20 CHAR)

What if you omit the option as follows?

VARCHAR2(20)

It depends on the global setting for length semantics.

You can check the setting as follows:

SELECT VALUE FROM NLS_DATABASE_PARAMETERS WHERE PARAMETER = 'NLS_LENGTH_SEMANTICS';

BYTE

References:
http://docs.oracle.com/cd/B28359_01/server.111/b28318/datatype.htm#CNCPT1824
http://oracleschools.blogspot.kr/2013/01/how-to-check-nlslengthsemantics.html

No comments:

Post a Comment