Oracle PL/SQL - Using Quoted User-Defined Identifiers

Introduction

The following code shows how to use the quoted identifier "MYNAME".

Without its enclosing double quotation marks, it is a valid identifier.

Therefore, the reference Hello is valid.

Demo

SQL>
SQL> DECLARE-- from w w  w .j a v a2  s  . c om
  2    "MYNAME" varchar2(10) := 'hello';
  3  BEGIN
  4    DBMS_Output.Put_Line(Hello);
  5  END;
  6  /
hello

PL/SQL procedure successfully completed.

SQL>

In the following code, the reference "Hello" is invalid, because the double quotation marks make the identifier case-sensitive.

Demo

SQL>
SQL> DECLARE-- from  w  ww .j  a  v  a 2s . com
  2    "MYNAME" varchar2(10) := 'hello';
  3  BEGIN
  4    DBMS_Output.Put_Line("Hello");
  5  END;
  6  /
  DBMS_Output.Put_Line("Hello");
                        *
ERROR at line 4:
ORA-06550: line 4, column 25:
PLS-00201: identifier 'Hello' must be declared
ORA-06550: line 4, column 3:
PL/SQL: Statement ignored


SQL>

Related Topic