For the life of me I cannot figure out what I'm doing wrong in this IF-ELSEIF-ELSE block. I coded up a small test to illustrate and here are the results:
SQL> DECLARE
2 pVariable VARCHAR2(10) := 'TEST';
3 BEGIN
4 IF pVariable = 'BLAH' THEN
5 DBMS_OUTPUT.PUT_LINE('BLAH');
6 ELSEIF pVariable = 'TEST' THEN
7 DBMS_OUTPUT.PUT_LINE('TEST');
8 ELSE
9 DBMS_OTPUT.PUT_LINE('UNKNOWN');
10 END IF;
11 END;
12 /
ELSEIF pVariable = 'TEST' THEN
*
ERROR at line 6:
ORA-06550: line 6, column 9:
PLS-00103: Encountered the symbol "PVARIABLE" when expecting one of the following:
:= . ( @ % ;
ORA-06550: line 11, column 4:
PLS-00103: Encountered the symbol ";" when expecting one of the following:
if
I have tried the following variation:
DECLARE
pVariable VARCHAR2(10) := 'TEST';
BEGIN
IF (pVariable='BLAH') THEN
DBMS_OUTPUT.PUT_LINE('BLAH');
ELSEIF (pVariable='TEST') THEN
DBMS_OUTPUT.PUT_LINE('TEST');
ELSE
DBMS_OTPUT.PUT_LINE('UNKNOWN');
END IF;
END;
The DB is Oracle 10gR2 10.2.0.3.
I have tried on SQL*Plus versions 10.2.0.3 & 8.1.7.0 and received the same error.
The documentation I have been referencing is:
http://download.oracle.com/docs/cd/B14117_01/appdev.101/b10807/04_struc.htm#sthref453