• 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 / ROWIDTOCHAR Function in Oracle SQL – PLSQL

ROWIDTOCHAR Function in Oracle SQL – PLSQL

November 22, 2012 by techhoneyadmin

The ROWIDTOCHAR function in Oracle SQL / PLSQL is used to cionvert the ROWID to VARCHAR2 datatype, the result is always 18 characters long.

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

Example:
Using ROWIDTOCHAR 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 ROWIDTOCHAR(ROWID)
FROM employee;

We may get the following result:

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

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


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

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