w3resource
PL/SQL Fundamentals Exercises

PL/SQL Fundamentals Exercises: PL/SQL block to show Reserved Word as User-Define Identifier

PL/SQL Fundamentals: Exercise-3 with Solution

Write a PL/SQL block to show a reserved word can be used as a user-define identifier.

In the example below quoted user-defined identifiers "DECLARE", "Declare", and "declare" have been declared. The word DECLARE, Declare and declare represent the same reserved word, "DECLARE", "Declare", and "declare" represent different identifiers.

PL/SQL Code:

DECLARE
  "DECLARE" varchar2(25) := 'This is UPPERCASE';
  "Declare" varchar2(25) := 'This is Proper Case';
  "declare" varchar2(25) := 'This is lowercase';
BEGIN
  DBMS_Output.Put_Line("DECLARE");
  DBMS_Output.Put_Line("Declare");
  DBMS_Output.Put_Line("declare");
END;
/

Sample Output:

This is UPPERCASE
This is Proper Case
This is lowercase

Statement processed.

0.16 seconds

Flowchart:

Flowchart: PL/SQL Fundamentals Exercise - PL/SQL block to show Reserved Word as User-Define Identifier

Improve this sample solution and post your code through Disqus

Previous: Write a PL/SQL block to show an invalid case-insensitive reference to a quoted and without quoted user-defined identifier.
Next: Write a PL/SQL block to show the result to neglect double quotation marks in reserved word identifier.

What is the difficulty level of this exercise?