Tuesday, May 22, 2007

PLS-00113 END identifier ABC must match XYZ at line L, column C

Just a quick note for a fairly uncommon PL/SQL syntax error.
I say uncommon because i got this for the first time after nearly 10 years of developing PL/SQL programs!

Scenario:

PACKAGE "PKG_TEST"
as
function test_fn return integer;
end "TEST";
PLS-00113 END identifier 'TEST' must match 'PKG_TEST' at line 1, column 9
The syntax error message is very clear, i forgot to prepend PKG to the identifier after the closing END statement to make them equal and the parser is checking out the consistency of these strings.

Note that specifying the closing identifier is optional, normally is just there for enhancing program readability, therefore you could safely remove it if you want to.
PACKAGE "TEST"
as
function test_fn return integer;
end; -- no identifier

Identifier cross checking is performed between package, procedure and function names and their respective closing END statements.
PACKAGE BODY "TEST"
as
function "TEST_FN"
return integer
is
begin
begin
return 1;
end "sub-block";
end "TEST_FN";
end "TEST";
In green you can see a spare identifier for an END statement of a PL/SQL sub-block.

Note also that identifiers are case sensitive when enclosed between double quotes and are automatically considered as written in uppercase if not, so, the following unit will return a syntax error:
PACKAGE BODY "TEST"
as
function test_fn
return integer
is
begin
begin
return 1;
end "sub-block";
end "test_fn";
end "TEST";
PLS-00113 END identifier 'test_fn' must match 'TEST_FN' at line 3, column 12

In conclusion, if for some reason you need to rename a procedure, a function or a package, you will have to check out also any closing END statement identifiers in order to successfully compile the unit.

5 comments:

CHE-I-ROA-KAN said...

Hi, Master Flavio,

Im using your blog, and u solved me a lot of problems, thx.

I foundn error that not appears in internet, and i don´t know how to fix it.

the error is:
PLS-00707: unsupported construct or internal error [2704].

I think that its a good error for The Annals of Oracle's Improbable Errors :), and when i'll turn from my holydays problably resolve it, and post the way to fix it.

Congratulations for your Bolg from spain, it's great!!!

:)
Merry Chritsmas

Byte64 said...

Thank you che-i-roa-kan, by the way, what a strange name, it sounds like that of a mayan god... ;-)

Con mucho gusto podemos publicar la solucion a ese tipo de error si logras recrear las condiciones para que se de.

Feliz Navidad.
Flavio

CHE-I-ROA-KAN said...

Hi flavio,

Im back from my holy-days and I fix the error, probably....jejeje, my code was:

loop
EXIT WHEN LLISTA(Number)%NOTFOUND;
LLISTA(Number):=Values(number);
Number:= Number+1;
end loop;

where LLISTA is

TYPE WARRAY IS VARRAY(324) OF VARCHAR2(200);

I put a for instead of loop.
the resulting code is:

FOR Number IN 0..LLISTA.count-1 LOOP LLISTA(number) := VALUES(number);
END LOOP;

the code compiles, but i dont know if it runs. (i have a lot of mistakes in my code, in JAVA or PL/SQL is the same ), but when i ll finish my project (over 20 jan) i post any chages if i ll do.

Thank you for your site and for your kindness .

i dont know how to say it but...

Felice Anno Novo

Che-i-Roa-Kan said...

:_( sorry, i have a mistake, or five,
i thounk than my confirmation word was wrong,....
....
....
I apologize my mistake....
....
....
Read you soon, i hope you´re not angry...

(Bruno is my real name, Che-I-Roa-Kan is Galician)

Byte64 said...

No problem Bruno,
i deleted the redundant comments...

By the way, there are several remarks that can be made on the pl/sql snippet you provided.

I'll publish a short commentary in a dedicated article as soon as i complete my tests.

Feliz año nuevo

yes you can!

Two great ways to help us out with a minimal effort. Click on the Google Plus +1 button above or...
We appreciate your support!

latest articles