This discussion is archived
2 Replies Latest reply: Feb 2, 2013 4:41 AM by cnu143 RSS

hi..."PL/SQL: ORA-00933: SQL command not properly ended"

cnu143 Newbie
Currently Being Moderated
Error starting at line 1 in command:
DECLARE
V_ENAME EMP.ENAME%TYPE;
V_SAL EMP.SAL%TYPE;
V_RANK INTEGER(2);
BEGIN
V_RANK:=&RN;
select ENAME,SAL,RNK from (select ENAME,SAL,dense_rank() over(order by sal desc) AS RNK from emp)
into V_ENAME,V_SAL,V_RANK from emp where RNK=V_RANK;
DOPL('EMPLOYEE NAME:'||V_ENAME);
DOPL('EMPLOYEE SAL:'||V_SAL);
DOPL('EMPLOYEE RANK:'||V_RNK);
END;

Error report:
ORA-06550: line 7, column 99:
PL/SQL: ORA-00933: SQL command not properly ended
ORA-06550: line 7, column 1:
PL/SQL: SQL Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause:    Usually a PL/SQL compilation error.
*Action:


hi..,when i executing above pl/sql program, it shows error...!
so i am unable to find error correctly..! plz help me..!

Regards..!
Cnu.
  • 1. Re: hi..."PL/SQL: ORA-00933: SQL command not properly ended"
    MLBrown Journeyer
    Currently Being Moderated
    Your SELECT syntax is messed up. The INTO should follow the SELECT. Is this what you are trying to do:
    DECLARE
      V_ENAME     EMP.ENAME%TYPE;
      V_SAL       EMP.SAL%TYPE;
      V_RANK      INTEGER (2);
    BEGIN
      V_RANK := &RN;
    
      select ENAME,
             SAL,
             RNK
        into V_ENAME,
             V_SAL,
             V_RANK
        from (select ENAME,
                     SAL,
                     dense_rank () over (order by sal desc) AS RNK
                from emp),
             emp
       where RNK = V_RANK;
    
      DOPL ('EMPLOYEE NAME:' || V_ENAME);
      DOPL ('EMPLOYEE SAL:' || V_SAL);
      DOPL ('EMPLOYEE RANK:' || V_RNK);
    END;
    By the way, looking at some of your past entries it looks like you have a bad habit of opening a request then never responding to it. You really should mark a entry as closed once it is no longer an issue. Also, if you mark helpful hints and helpful and correct hints as correct it makes people that help you happy and they are more likely going to help you again in the future... just saying.
  • 2. Re: hi..."PL/SQL: ORA-00933: SQL command not properly ended"
    cnu143 Newbie
    Currently Being Moderated
    hi,
    your answers is write,
    but in that i did small change is

    "select ENAME,
    SAL,
    RNK
    into V_ENAME,
    V_SAL,
    V_RANK
    from (select ENAME,
    SAL,
    dense_rank () over (order by sal desc) AS RNK
    from emp)*,*
    *emp*
    where RNK = V_RANK;

    After change...........!it will work correctly...!

    DECLARE
    V_ENAME EMP.ENAME%TYPE;
    V_SAL EMP.SAL%TYPE;
    V_RANK INTEGER (2);
    BEGIN
    V_RANK := &RN;
    select ENAME,
    SAL,
    RNK
    into V_ENAME,
    V_SAL,
    V_RANK
    from (select ENAME,
    SAL,
    dense_rank () over (order by sal desc) AS RNK
    from emp)
    where RNK = V_RANK;
    DOPL ('EMPLOYEE NAME:' || V_ENAME);
    DOPL ('EMPLOYEE SAL:' || V_SAL);
    DOPL ('EMPLOYEE RANK:' || V_RANK);
    END;

    Thank you for ur help.

    Edited by: 964805 on Feb 2, 2013 6:10 PM

Legend

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