UTL_RAW “invalid identifier” error message

Posted on

Question :

When I execute the following:

select utl_raw.cast_to_raw('8') from dual;

I receive the error message below:

invalid identifier

…while in other PC with the same Oracle version, i.e., 11g, the query is ok.

My questions

  • What’s the origin of this error message?

  • How can I fix it?

I found no related docs in the web.

Comment interactions

Is “other PC” connecting to the same Database Instance? – @Michael Kutz

I installed the same version of Oracle in two PCs, but only in one of them I received this error when I tried to make a backup.

Answer :

By default, execute privilege on UTL_RAW package is granted to PUBLIC, meaning any database user can execute it.

Getting “invalid identifier” error means the package or referenced function does not exist, or you do not have the necessary privilege to execute it.

Either way, you have a non-standard environment.

Maybe it has fallen victim of overzealous security hardening and the execute privilege was revoked from PUBLIC.

Be Cautious When Revoking Privileges Granted to PUBLIC (Doc ID 247093.1)

Or it was revoked following documents such as:

Master Note for Oracle XML Database (XDB) Install / Deinstall (Doc ID 1292089.1)

To view the above documents, you need an Oracle account with a valid support contract associated with it.

As a DBA, you should know why the privilege was revoked. If you are not the DBA, ask the DBA who is responsible for this database.

If you want to restore the default state of this:

grant execute on sys.utl_raw to public;

That is how the package was originally created, you can view this in its definition:

$ grep utl_raw $ORACLE_HOME/rdbms/admin/prvtrawb.plb
create or replace public synonym utl_raw for sys.utl_raw
grant execute on sys.utl_raw to public

Leave a Reply

Your email address will not be published. Required fields are marked *