w3resource

Oracle NLS_CHARSET_DECL_LEN function

Description

The Oracle NLS_CHARSET_DECL_LEN function is used to returns the declaration length (in a number of characters) of an NCHAR column.

Uses of Oracle NLS_CHARSET_DECL_LEN Function
  • Determine Character Length: Calculate the number of characters in a specified byte width for NCHAR columns.

  • Multibyte Character Set Handling: Account for character sets where characters may occupy more than one byte.

  • Database Schema Management: Assist in defining or modifying the schema to ensure appropriate column lengths based on character sets.

  • Character Set Specific Operations: Facilitate operations that depend on specific character set IDs.

Syntax:

NLS_CHARSET_DECL_LEN(byte_count, 'char_set_id')

Parameter:

Name Description
byte_count The byte_count argument is the width of the column.
char_set_id The char_set_id argument is the character set ID of the column.

Examples: Oracle NLS_CHARSET_DECL_LEN function

The following example returns the number of characters that are in a 200-byte column when you are using a multibyte character set:

SELECT NLS_CHARSET_DECL_LEN(200, nls_charset_id('ja16eucfixed')) 
FROM DUAL;
 

Sample Output:

 NLS_CHARSET_DECL_LEN(200,NLS_CHARSET_ID('JA16EUCFIXED'))
--------------------------------------------------------
                                                     100

Previous: REGEXP_INSTR
Next: NLS_CHARSET_ID



Follow us on Facebook and Twitter for latest update.