5 Replies Latest reply on Mar 23, 2016 10:02 AM by Jagadekara

    ORA-00905: missing keyword error

    Mebu

      Hi All,

       

      When I tried to run the below query, the 'ORA-00905: missing keyword error' is showing always.

       

      SELECT

      EMPLOYEE.NAME,EMPLOYEE.ID,EMPLOYEE.MANAGER_ID,

      WORK_DETAILS.WORK_ID AS Workid,NVL(WORK_DETAILS.WORK_TIME,0) AS "TOTAL_HOURS_WORK"

      ,NVL(LEAVEDETAILS.TOTAL_HOURS_LEAVE,0) AS "TOTAL_HOURS_LEAVE"

      ,NVL((WORK_DETAILS.WORK_TIME - LEAVEDETAILS.TOTAL_HOURS_LEAVE),WORK_DETAILS.WORK_TIME) AS "TOTAL_BALANCE"

      FROM

      (SELECT V_WORK_DETAILS.WORK_ID,

      SUM(case V_WORK_DETAILS.WORK_TIME when s.S_ID =1 and to_char(to_date(w.working_date,'dd/mm/yyyy'),'d')  = 7 then 0

      when s.s_id =2 and to_char(to_date(w.working_date,'dd/mm/yyyy'),'d')  = 7 then V_WORK_DETAILS.WORK_TIME / 2

      when s.s_id =3 AND to_char(to_date(w.working_date,'dd/mm/yyyy'),'d')  = 7 then V_WORK_DETAILS.WORK_TIME 

      when s.s_id =4 AND to_char(to_date(w.working_date,'dd/mm/yyyy'),'d')  = 7 then (150/100)* V_WORK_DETAILS.WORK_TIME

      when s.s_id =1 and to_char(to_date(w.working_date,'dd/mm/yyyy'),'d') != 7 then 0

      when s.s_id =2 and to_char(to_date(w.working_date,'dd/mm/yyyy'),'d') != 7 then 0

      when s.s_id =3 AND to_char(to_date(w.working_date,'dd/mm/yyyy'),'d') != 7 then V_WORK_DETAILS.WORK_TIME 

      when s.s_id =4 AND to_char(to_date(w.working_date,'dd/mm/yyyy'),'d') != 7 then (200/100)* V_WORK_DETAILS.WORK_TIME

      end )WORK_TIME FROM  V_WORK_DETAILS w JOIN CA_SETTLEMENTS s on s.s_id =w.s_id GROUP BY V_WORK_DETAILS.WORK_ID)  WORK_DETAILS,

      (SELECT V_LEAVEDETAILS.WORK_ID,SUM(V_LEAVEDETAILS.LEAVE) "TOTAL_HOURS_LEAVE" FROM V_LEAVEDETAILS GROUP BY V_LEAVEDETAILS.WORK_ID)  LEAVEDETAILS,

      (SELECT V_EMPLOYEE.WORK_ID,V_EMPLOYEE.FIRST_NAME||V_EMPLOYEE.LAST_NAME AS NAME,V_EMPLOYEE.ID,V_EMPLOYEE.MANAGER_ID FROM V_EMPLOYEE  GROUP BY V_EMPLOYEE.WORK_ID,V_EMPLOYEE.FIRST_NAME||V_EMPLOYEE.LAST_NAME,V_EMPLOYEE.ID,V_EMPLOYEE.MANAGER_ID)  EMPLOYEE

      WHERE WORK_DETAILS.WORK_ID = LEAVEDETAILS.WORK_ID(+)

      AND EMPLOYEE.WORK_ID(+) = WORK_DETAILS.WORK_ID;

       


      Kindly advise.

       

       

      Regards,

      Mebu