1. Derby
  2. DERBY-533

Re-enable national character datatypes


    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s:
    • Fix Version/s: None
    • Component/s: SQL
    • Labels:


      SQL 2003 coyly defines national character types as "implementation defined". Accordingly, there is considerable variability in how these datatypes behave. Oracle and MySQL use these datatypes to store unicode strings. This would not distinguish national from non-national character types in Derby since Derby stores all strings as unicode sequences.

      The national character datatypes (NCHAR, NVARCHAR, NCLOB and their synonymns) used to exist in Cloudscape but were disabled in Derby. The disabling comment in the grammar says "need to re-enable according to SQL standard". Does this mean that the types were removed because they chafed against SQL 2003? If so, what are their defects?


      Cloudscape 3.5 provided the following support for national character types:

      • NCHAR and NVARCHAR were legal datatypes.
      • Ordering operations on these datatypes was determined by the collating sequence associated with the locale of the database.
      • The locale was a DATABASE-wide property which could not be altered.
      • Ordering on non-national character datatypes was lexicographic, that is, character by character.


      Oracle 9i provides the following support for national character types:

      • NCHAR, NVARCHAR2, and NCLOB datatypes are used to store unicode strings.
      • Sort order can be overridden per SESSION or even per QUERY, which means that these overridden sort orders are not supported by indexes.


      DB2 does not appear to support national character types. Nor does its DRDA data interchange protocol.


      MySQL provides the following support for national character types:

      • National Char and National Varchar datatypes are used to hold unicode strings. I cannot find a national CLOB type.
      • The character set and sort order can be changed at SERVER-wide, TABLE-wide, or COLUMN-specific levels.


      If we removed the disabling logic in Derby, I believe that the following would happen:

      • We would get NCHAR, NVARCHAR, and NCLOB datatypes.
      • These would sort according to the locale that was bound to the database when it was created.
      • We would have to build DRDA transport support for these types.

      The difference between national and non-national datatypes would be their sort order.

      I am keenly interested in understanding what defects (other than DRDA support) should be addressed in the disabled implementation.

        Issue Links


          Rick Hillegas created issue -
          Rick Hillegas made changes -
          Field Original Value New Value
          Link This issue is blocked by DERBY-554 [ DERBY-554 ]
          Kathey Marsden made changes -
          Link This issue relates to DERBY-1478 [ DERBY-1478 ]
          Daniel John Debrunner made changes -
          Link This issue is blocked by DERBY-554 [ DERBY-554 ]
          Rick Hillegas made changes -
          Status Open [ 1 ] Closed [ 6 ]
          Resolution Fixed [ 1 ]
          Daniel John Debrunner made changes -
          Status Closed [ 6 ] Reopened [ 4 ]
          Resolution Fixed [ 1 ]
          Daniel John Debrunner made changes -
          Status Reopened [ 4 ] Closed [ 6 ]
          Resolution Won't Fix [ 2 ]
          Dag H. Wanvik made changes -
          Issue Type New Feature [ 2 ] Improvement [ 4 ]
          Gavin made changes -
          Workflow jira [ 12323729 ] Default workflow, editable Closed status [ 12800591 ]


            • Assignee:
              Rick Hillegas
            • Votes:
              2 Vote for this issue
              0 Start watching this issue


              • Created: