Write a PL/SQL block to show the result to neglect double quotation marks in reserved word identifier.
In the example below he references should be a quoted user-defined identifier which is a reserved word and also have been neglected to enclose it in double quotation marks.
DECLARE
"WORLD" varchar2(20) := 'world'; -- WORLD is not a reserved word
"DECLARE" varchar2(20) := 'declare'; -- DECLARE is a reserved word
BEGIN
DBMS_Output.Put_Line(World); -- Double quotation marks are optional
DBMS_Output.Put_Line(DECLARE); -- Double quotation marks are required
end;
/
Sample Output:
ORA-06550: line 6, column 24:
PLS-00103: Encountered the symbol "DECLARE" when expecting one of the following:
( ) - + case mod new not null
table continue avg count current exists max min prior sql
stddev sum variance execute multiset the both leading
trailing forall merge year month day hour minute second
timezone_hour timezone_minute timezone_region timezone_abbr
time timestamp interval date
4. BEGIN
5. DBMS_Output.Put_Line(World); -- Double quotation marks are optional
6. DBMS_Output.Put_Line(DECLARE); -- Double quotation marks are required
7. end;
8. /
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer