• Skip to primary navigation
  • Skip to main content

Tech Honey

The #1 Website for Oracle PL/SQL, OA Framework and HTML

  • Home
  • HTML
    • Tags in HTML
    • HTML Attributes
  • OA Framework
    • Item in OAF
    • Regions in OAF
    • General OAF Topics
  • Oracle
    • statement
    • function
    • clause
    • plsql
    • sql
You are here: Home / Oracle / function / ROWIDTONCHAR Function in Oracle SQL – PLSQL

ROWIDTONCHAR Function in Oracle SQL – PLSQL

November 22, 2012 by techhoneyadmin

The ROWIDTONCHAR function in Oracle SQL / PLSQL is used to cionvert the ROWID to NVARCHAR2 data type, the result is always in National Character Set and 18 characters long.

Syntax for using the ROWIDTONCHAR function Oracle SQL / PLSQL is;
SELECT ROWIDTONCHAR (ROWID)
FROM table_name;

Example:
Using ROWIDTONCHAR function

Suppose we have a table named ‘employee’ as shown below:

Employee_ID Employee_Name Salary Department Commission
101 Emp A 10000 Sales 10
102 Emp B 20000 IT 20
103 Emp C 28000 IT 20
104 Emp D 30000 Support 5
105 Emp E 32000 Sales 10
106 Emp F 40000 Sales 10
107 Emp G 12000 Sales 10
108 Emp H 12000 Sales 10

If we write our query as:

SELECT ROWIDTONCHAR(ROWID)
FROM employee;

We may get the following result:

ROWIDTONCHAR(ROWID)
AAAPD2AABAAAS2aAAA
AAAPD2AABAAAS2aAAB
AAAPD2AABAAAS2aAAC
AAAPD2AABAAAS2aAAD
AAAPD2AABAAAS2aAAE
AAAPD2AABAAAS2aAAF
AAAPD2AABAAAS2aAAG
AAAPD2AABAAAS2aAAH

Here we can see that we have converted all the “rowids” into NVARCHAR2 data type and all the records are 18 characters long.


Filed Under: function Tagged With: how to use ROWIDTONCHAR function in oracle database query, how to use ROWIDTONCHAR function in oracle plsql, how to use ROWIDTONCHAR function in oracle sql, ROWIDTONCHAR function in oracle plsql, ROWIDTONCHAR function in oracle sql, ROWIDTONCHARPLSQL, syntax and example of ROWIDTONCHAR function in oracle database query, syntax and example of ROWIDTONCHAR function in oracle plsql, syntax and example of ROWIDTONCHAR function in oracle sql, using ROWIDTONCHAR function in oracle database query, using ROWIDTONCHAR function in oracle plsql, using ROWIDTONCHAR function in oracle sql

Copyright © 2023 · Parallax Pro on Genesis Framework · WordPress · Log in