3 Replies Latest reply: Jul 31, 2008 1:10 PM by 181444 RSS

    max size of varchar2


      we want to migrate our database to UTF8.

      We run CSSCAN and found a couple of table columns with varchar2(4000) to enlarge.

      Has any body an idea how to solve this problem?

      Thank you for reading!

        • 1. Re: max size of varchar2
          Maximum varchar2 size is 4000 bytes. In case of Unicode it might be fewer characters because they use more than one byte. So either trim data, use clobs or split data into more than one column.

          Gints Plivna
          • 2. Re: max size of varchar2
            What's Oracle version?

            What's NLS_LENGTH_SEMANTICS setting ?

            Do you have all English characters?

            The problem here is varchar2 has size limit of 4000 bytes.
            For single byte character set, that translate to 4000 characters.

            However, for multi-byte character set like UTF8, some character require more than one byte to save, for example chinese character need 3 bytes per character. So your varchar2(4000) columns could not save 4000 characters in some cases and that could result data truncation. If you really need guaranteed to save 4000 characters in column you might have to use CLOB type.
            • 3. Re: max size of varchar2
              1- 4000 bytes is an absolute limit for varchar2 and nvarchar2 columns.
              2- UTF8 is obsolete so you really mean that you are going to use AL32UTF8 right?

              HTH -- Mark D Powell --