Using Fully Qualified Database Link Name With a Hyphen in the Domain Name From PL/SQL Fails With ORA-02083, But Not From Regular SQL (Doc ID 331169.1)

Last updated on AUGUST 28, 2017

Applies to:

PL/SQL - Version 8.0.6.0 and later
Information in this document applies to any platform.
***Checked for relevance on 24-Aug-2017***


Symptoms

This problem is characterized by an ORA-2083 'database name has illegal character '-'' error when using a fully qualified database link that has a hyphen in the domain name.

When remote database i.e standby database is 8.0.6

ORA-02083: database name has  illegal character '
PLS-00905 object is invalid (for package compilation)


When remote database i.e standby database is 8.1.7 or later

ORA-02083: database name has illegal character '`'
ORA-06553: PLS-707: unsupported construct or internal error [2604]

This error only occurs when the database link is used in PL/SQL. 

When the same database link is used in SQL, the call is successful.

This could especially happen when the remote database is a READ ONLY STANDBY Database.

Even if the CREATE DATABASE LINK succeeds:

 

SQL> create database link "<name with hyphen>" using 'ora92';

Database link created.



The PL/SQL execution fails when referencing the DATABASE LINK Unquoted:

 

SQL>
SQL> declare
  2      i number;
  3      begin
  4      select count(*) into i from x@
<name with hyphen>;
  5  end;
  6  /
    select count(*) into i from x@
<name with hyphen>;
                                             *

ERROR at line 4:

ORA-06550: line 4, column 46:

PL/SQL: ORA-00933: SQL command not properly ended

ORA-06550: line 4, column 5:

PL/SQL: SQL Statement ignored

The PL/SQL execution fails when referencing the DATABASE LINK quoted:

 

SQL> declare

  2      i number;

  3      begin

  4      select count(*) into i from x@"<name with hyphen>";

  5  end;

  6  /

    select count(*) into i from x@"<name with hyphen>";

                                                                        *

ERROR at line 4:

ORA-06550: line 4, column 33:

PL/SQL: ORA-02083: database name has illegal character '-'

ORA-06550: line 4, column 5:

PL/SQL: SQL Statement ignored

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms