Oracle / PLSQL: CHARTOROWID Function

This article is written about how to use the Oracle/PLSQL CHARTOROWID function with syntax and examples.

Description

The Oracle/PLSQL CHARTOROWID function converts a char, varchar2, nchar, or nvarchar2 to a rowid.

Syntax

The syntax for the CHARTOROWID function in Oracle/PLSQL is:

CHARTOROWID( value1 )

Parameters or Arguments

value1

The value to convert to a rowid.

Returns

The CHARTOROWID function returns a rowid. The rowid is formatted as follows:

BBBBBBB.RRRR.FFFFF

where:

BBBBBBB is the block in the database file.

RRRR is the row in the block.

FFFFF is the database file.

Applies To

The CHARTOROWID function can be used in the following versions of Oracle/PLSQL:

Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i, Oracle 8i

Example

Let’s look at some Oracle CHARTOROWID function examples and explore how to use the CHARTOROWID function in Oracle/PLSQL.

For example:

select * from suppliers
where rowid = CHARTOROWID('AAABoqAADAAAAwPAAA');

This would return a unique row from the suppliers table.