w3resource

PL/SQL Fundamentals Exercises: PL/SQL block to Neglect the Case Sensitivity of a Reserved Word

PL/SQL Fundamentals: Exercise-5 with Solution

Write a PL/SQL block to show the result to neglect the case sensitivity of a user defined identifier which is also a reserved word.

In the example below the reference is a quoted user-defined identifier which is also a reserved word, neglecting its case-sensitivity.

PL/SQL Code:

DECLARE
  "WORLD" varchar2(10) := 'world';  -- WORLD is not a reserved word
  "DECLARE" varchar2(10) := 'declare';  -- DECLARE is a reserved word
BEGIN
  DBMS_Output.Put_Line(World);      -- Identifier is case-insensitive
  DBMS_Output.Put_Line("Declare");      -- Identifier is case-sensitive
end;
/

Sample Output:

ORA-06550: line 6, column 25:
PLS-00201: identifier 'Declare' must be declared
ORA-06550: line 6, column 3:
PL/SQL: Statement ignored

4. BEGIN
5.   DBMS_Output.Put_Line(World);      -- Identifier is case-insensitive
6.   DBMS_Output.Put_Line("Declare");      -- Identifier is case-sensitive
7. end;
8. /

Flowchart:

Flowchart: PL/SQL Fundamentals Exercise - PL/SQL block to Neglect the Case Sensitivity of a Reserved Word

Improve this sample solution and post your code through Disqus

Previous: Write a PL/SQL block to show the result to neglect double quotation marks in reserved word identifier.
Next: Write a PL/SQL block to show single and multiline comments.

What is the difficulty level of this exercise?



Follow us on Facebook and Twitter for latest update.