Oracle NCHR() Function
Oracle NCHR()
is a built-in function that returns the character corresponding to the given integer parameter as a NVARCHAR2
type.
NCHR()
is equivalent to CHR()
with USING NCHAR_CS
clause.
Oracle NCHR()
syntax
Here is the syntax for the Oracle NCHR()
function:
NCHR(n)
NCHR(n)
is equivalent to CHR(n USING NCHAR_CS)
.
Parameters
n
-
Required. A value of
NUMBER
type or any expression that can be implicitly converted to aNUMBER
value.
Return Value
The Oracle NCHR()
function returns the character corresponding to the given integer parameter as a NVARCHAR2
type.
If any parameter is NULL
, NCHR()
will return NULL
.
Oracle NCHR()
Examples
Here are some examples that demonstrate the usage of the Oracle NCHR()
function.
Basic Usage
The following statement uses the Oracle NCHR()
function to convert 67
to a character:
SELECT NCHR(67)
FROM dual;
Output:
NCHR(67)
___________
C
You can also use CHR(n USING NCHAR_CS)
instead of it:
SELECT
CHR(67 USING NCHAR_CS) Result
FROM dual;
Output:
RESULT
_________
C
Let’s look at another example:
SELECT
NCHR(257) "NCHR(257)",
CHR(257 USING NCHAR_CS) "CHR(257 USING NCHAR_CS)"
FROM dual;
Output:
NCHR(257) CHR(257 USING NCHAR_CS)
____________ __________________________
ā ā
NULL Parameters
If any parameter is NULL
, NCHR()
will return NULL
.
SET NULL 'NULL';
SELECT
NCHR(NULL)
FROM dual;
Output:
NCHR(NULL)
_____________
NULL
In this example, we use the statement SET NULL 'NULL';
to display NULL
values as the string 'NULL'
.
Conclusion
Oracle NCHR()
is a built-in function that returns the character corresponding to the given integer parameter as a NVARCHAR2
type.