Results 1 to 10 of 10
  1. #1
    Join Date
    Feb 2012
    Posts
    5

    Unanswered: plsql error 00103-

    hi based on the following information
    grade lowsal highsal
    ------ ----- ------
    1 700 1200
    2 1201 1400
    3 1401 2000
    4 2001 3000
    5 3001 9999
    for the employee table to assign grade for each employee based on his salary
    the following plsql procedure is giving error:
    -----------------------------------------------------------
    CREATE OR REPLACE PROCEDURE GRADE(EID IN NUMBER,BONUS OUT NUMBER) IS

    vGRADE NUMBER(8,2);
    vSAL NUMBER(8,2);

    BEGIN
    vGRADE=1
    SELECT SAL INTO vSAL FROM EMP WHERE EMPNO=EMPID;
    IF vSAL<= 700 THEN
    vGRADE:=1;
    ELSEIF vSAL<= 1201 THEN
    vGRADE:=2;
    ELSEIF vSAL<= 1401 THEN
    vGRADE:=3;
    ELSEIF vSAL<= 2001 THEN
    vGRADE:=4;
    ELSEIF vSAL<= 3001 THEN
    vGRADE:=5;
    ELSE
    vGRADE:=0;
    END IF;
    GRADE:=vGRADE;

    END;
    ---------------------------------------------------------------
    8/9 PLS-00103 encountered the symbol "VSAL" when expecting one of the following := . ( @ % ;

    10/9 PLS-00103 encountered the symbol "VSAL" when expecting one of the following := . ( @ % ;

    12/9 PLS-00103 encountered the symbol "VSAL" when expecting one of the following := . ( @ % ;

    14/9 PLS-00103 encountered the symbol "VSAL" when expecting one of the following := . ( @ % ;

    20/4 PLS-00103 encountered the symbol ";" when expecting one of the following :
    if

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >vGRADE=1
    not as above but as below

    vGRADE=1;

    statements are terminated by semicolon character; but you already knew that didn't you?
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Feb 2012
    Posts
    5

    plsql 00103

    hi thanks but actually it is like this with the same error


    CREATE OR REPLACE PROCEDURE GRADE(EID IN NUMBER,BONUS OUT NUMBER) IS

    vGRADE NUMBER(8,2);
    vSAL NUMBER(8,2);

    BEGIN
    SELECT SAL INTO vSAL FROM EMP WHERE EMPNO=EMPID;
    IF vSAL<= 700 THEN
    vGRADE:='A';
    ELSEIF vSAL<= 1201 THEN
    vGRADE:='B';
    ELSEIF vSAL<= 1401 THEN
    vGRADE:='C';
    ELSEIF vSAL<= 2001 THEN
    vGRADE:='D';
    ELSEIF vSAL<= 3001 THEN
    vGRADE:='E';
    ELSE
    vGRADE:='F';
    END IF;
    GRADE:=vGRADE;

    END;

  4. #4
    Join Date
    Mar 2010
    Location
    Vienna, Austria
    Posts
    149
    it's not the same error.
    Now you are assigning characters ('A', 'B', ..., 'F') to a NUMBER(8,2) variable (vGRADE)

    (by the way: a CASE statement would make much more sense)
    Last edited by magicwand; 02-09-12 at 17:44. Reason: CASE hint added
    "There is always an easy solution to every problem - neat, plausible, and wrong."
    -- H.L. Mencken

  5. #5
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >hi thanks but actually it is like this with the same error
    Too bad COPY & PASTE are broken for you
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  6. #6
    Join Date
    Feb 2012
    Posts
    5
    I am sorry for the confusion,I tried out everything but does'nt seem to be working thanks for your help in advance
    it's this
    ------------------------------------------------------------
    CREATE OR REPLACE PROCEDURE GRADE(EID IN NUMBER,BONUS OUT NUMBER) IS

    vGRADE NUMBER(2);
    vSAL NUMBER(8,2);

    BEGIN
    SELECT SAL INTO vSAL FROM EMP WHERE EMPNO=EMPID;
    IF vSAL<= 700 THEN
    vGRADE:=1;
    ELSEIF vSAL<= 1201 THEN
    vGRADE:=2;
    ELSEIF vSAL<= 1401 THEN
    vGRADE:=3';
    ELSEIF vSAL<= 2001 THEN
    vGRADE:=4;
    ELSEIF vSAL<= 3001 THEN
    vGRADE:=5';
    ELSE
    vGRADE:=0;
    END IF;
    GRADE:=vGRADE;

    END;
    ------------------------------------------------------------
    8/9 PLS-00103 encountered the symbol "VSAL" when expecting one of the following := . ( @ % ;

    10/9 PLS-00103 encountered the symbol "VSAL" when expecting one of the following := . ( @ % ;

    12/9 PLS-00103 encountered the symbol "VSAL" when expecting one of the following := . ( @ % ;

    14/9 PLS-00103 encountered the symbol "VSAL" when expecting one of the following := . ( @ % ;

    20/4 PLS-00103 encountered the symbol ";" when expecting one of the following :
    if

  7. #7
    Join Date
    Mar 2010
    Location
    Vienna, Austria
    Posts
    149
    1.) I'd suggest
    Code:
    SELECT SAL INTO vSAL FROM EMP WHERE EMPNO=EID;
    instead of your
    Code:
    SELECT SAL INTO vSAL FROM EMP WHERE EMPNO=EMPID;
    2.)
    Code:
    GRADE:=vGRADE;
    you should either declare a variable GRADE or assign vGrade to BONUS (which would make more sense)

    3.) Because ELSEIF is not a PL/SQL reserved word, the parser treats it as variable and expects an assingment operator (:=).

    Try ELSIF instead

    4.) i still think, a CASE statement would make the code much more readable
    (or - at least - use code tags)
    Last edited by magicwand; 02-09-12 at 18:27.
    "There is always an easy solution to every problem - neat, plausible, and wrong."
    -- H.L. Mencken

  8. #8
    Join Date
    Feb 2012
    Posts
    5

    @magicwand

    thank you ....it worked

  9. #9
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    Consider actually Reading This Fine Manual

    Contents
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  10. #10
    Join Date
    Feb 2012
    Posts
    5
    Thank you ....i will

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •