This discussion is archived
3 Replies Latest reply: Mar 20, 2010 7:19 AM by 761444 RSS

PLS-00103: Encountered the symbol "end-of-file" when expecting one of the..

761444 Newbie
Currently Being Moderated
Keep getting the following error :

Error starting at line 1 in command:
DECLARE
snumber S_STUDENT.STUDENTNO%TYPE;:='&snum';
saddress S_STUDENT.ADDRESS%TYPE:='&saddress';
pcode S_STUDENT.PROGRAMCODE%TYPE:='&pcode';
scode S_STUDENT.STAGECODE%TYPE:='&scode';
Error report:
ORA-06550: line 2, column 34:
PLS-00103: Encountered the symbol "=" when expecting one of the following:

begin function pragma procedure subtype type <an identifier>
<a double-quoted delimited-identifier> current cursor delete
exists prior
06550. 00000 - "line %s, column %s:\n%s"
*Cause:    Usually a PL/SQL compilation error.
*Action:


My Code:

--Declaring variables to hold a  student name,a student address, a program code and a stage code.

DECLARE
snumber S_STUDENT.STUDENTNO%TYPE;:='&snum';
saddress S_STUDENT.ADDRESS%TYPE:='&saddress';
pcode S_STUDENT.PROGRAMCODE%TYPE:='&pcode';
scode S_STUDENT.STAGECODE%TYPE:='&scode';


Any help appeciated. :)
  • 1. Re: PLS-00103: Encountered the symbol "end-of-file" when expecting one of the..
    Hoek Guru
    Currently Being Moderated
    Looks like you put in a ';' in the wrong place:
    Shouldn't
    snumber S_STUDENT.STUDENTNO%TYPE;:='&snum';
    be:
    snumber S_STUDENT.STUDENTNO%TYPE :='&snum';
    ?
  • 2. Re: PLS-00103: Encountered the symbol "end-of-file" when expecting one of the..
    761444 Newbie
    Currently Being Moderated
    Nope that was me just trying to run the one line its still the same error when i run

    "DECLARE
    snumber S_STUDENT.STUDENTNO%TYPE:='&snum';
    saddress S_STUDENT.ADDRESS%TYPE:='&saddress';
    pcode S_STUDENT.PROGRAMCODE%TYPE:='&pcode';
    scode S_STUDENT.STAGECODE%TYPE:='&scode';
    "
  • 3. Re: PLS-00103: Encountered the symbol "end-of-file" when expecting one of the..
    Hoek Guru
    Currently Being Moderated
    Are you sure?
    SQL> declare
      2  snumber number;:='&snum';
      3  saddress varchar2(100):='&saddress';
      4  begin
      5  
      6   for rec in ( select level lvl
      7                from   dual
      8                connect by level <= snumber
      9               )
     10   loop
     11     dbms_output.put_line(rec.lvl);
     12   end loop;
     13   dbms_output.put_line(saddress);
     14  end;
     15  /
    Enter value for snum: 3
    old   2: snumber number;:='&snum';
    new   2: snumber number;:='3';
    Enter value for saddress: some street
    old   3: saddress varchar2(100):='&saddress';
    new   3: saddress varchar2(100):='some street';
    snumber number;:='3';
                   *
    ERROR at line 2:
    ORA-06550: line 2, column 16:
    PLS-00103: Encountered the symbol "=" when expecting one of the following:
    begin function package pragma procedure subtype type use
    <an identifier> <a double-quoted delimited-identifier> form
    current cursor
    and after removing the ';' (the one after the 'number' keyword) I get:
    SQL> declare
      2  snumber number:='&snum';
      3  saddress varchar2(100):='&saddress';
      4  begin
      5  
      6   for rec in ( select level lvl
      7                from   dual
      8                connect by level <= snumber
      9               )
     10   loop
     11     dbms_output.put_line(rec.lvl);
     12   end loop;
     13   dbms_output.put_line(saddress);
     14  end;
     15  /
    Enter value for snum: 3
    old   2: snumber number:='&snum';
    new   2: snumber number:='3';
    Enter value for saddress: some street
    old   3: saddress varchar2(100):='&saddress';
    new   3: saddress varchar2(100):='some street';
    1
    2
    3
    some street
    
    PL/SQL procedure successfully completed.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points