Oracle ROWIDTONCHAR() Function
Oracle ROWIDTONCHAR() is a built-in function that converts a given rowid value to the VARCHAR2 data type.
Unlike ROWIDTOCHAR(), the return value of ROWIDTONCHAR() is always in the national character set.
Oracle ROWIDTONCHAR() Syntax
Here’s the syntax for the Oracle ROWIDTONCHAR() function:
ROWIDTONCHAR(rowid)
Parameters
rowid-
Required.
Return Value
The Oracle ROWIDTONCHAR() function returns a string value of length 18 that represents the given rowid value.
If any of the parameters is NULL, ROWIDTONCHAR() returns NULL.
Oracle ROWIDTONCHAR() Examples
Here are some examples that demonstrate how to use the Oracle ROWIDTONCHAR() function.
Basic Usage
The following statement converts a rowid value to a character value:
SELECT
ROWIDTONCHAR('AAAACPAABAAAAWRAAA')
FROM dual;
输出:
ROWIDTONCHAR('AAAACPAABAAAAWRAAA')
____________________________________
AAAACPAABAAAAWRAAAHere’s a better example:
SELECT
ROWID,
DUMP(ROWID, 17, 1, 1),
DUMP(ROWIDTONCHAR(ROWID), 17, 1, 1)
FROM dual;
输出:
ROWID DUMP(ROWID,17,1,1) DUMP(ROWIDTONCHAR(ROWID),17,1,1)
_____________________ _____________________ ___________________________________
AAAACPAABAAAAWRAAA Typ=69 Len=10: ^@ Typ=1 Len=36: ^@NULL Parameters
If any of the parameters is NULL, ROWIDTONCHAR() returns NULL.
SET NULL 'NULL';
SELECT
ROWIDTONCHAR(NULL)
FROM dual;
输出:
ROWIDTONCHAR(NULL)
_____________________
NULLIn this example, we use the SET NULL 'NULL'; statement to display NULL values as the string 'NULL'.
Conclusion
Oracle ROWIDTONCHAR() is a built-in function that converts a given rowid value to the VARCHAR2 data type in the national character set.