ORA-00904: "GETEMPLOYEE_MASSIONDAYS": - " %s: недопустимый идентификатор"
Я создаю функцию для суммирования дней в моей таблице и хочу отобразить эти дни для каждого сотрудника в запросе select.
Что я уже пробовал:
это и есть функция :-
create or replace FUNCTION "GETEMPLOYEE_MassionDays" (EMPLOYEE_ID_P NUMBER,month_P number,year_P number) RETURN decimal IS VALUE_P decimal; BEGIN SELECT SUM(TO_DATE(PROF_TASKS.TASK_END_DATE) - TO_DATE(PROF_TASKS.TASK_START_DATE) + 1) into VALUE_P FROM PROF_TASKS where EMPLOYEE_ID=EMPLOYEE_ID_P and extract(month from TASK_START_DATE)=month_P and extract(year from TASK_START_DATE)=year_P order by TASK_START_DATE ; RETURN VALUE_P; END;
и это select query :-
SELECT PROF_TASKS.EMP_CODE ,PROF_EMPLOYEE_DATA.EMP_NAME_AR ,PROF_TREE_DETAILS.TREE_NAME ,nvl(GETEMPLOYEE_MassionDays(PROF_EMPLOYEE_DATA.EMPLOYEE_ID,extract(month from to_date('01/10/2016','dd/mm/yyyy')),extract(year from to_date('01/10/2016','dd/mm/yyyy'))),0) as MissionDays FROM PROF_COMPANY_DETAILS RIGHT JOIN PROF_BRANCHES_DETAILS ON PROF_COMPANY_DETAILS.COMPANY_ID = PROF_BRANCHES_DETAILS.COMPANY_ID RIGHT JOIN PROF_GENERAL_DEPARTMENT ON PROF_BRANCHES_DETAILS.BRANCH_ID = PROF_GENERAL_DEPARTMENT.BRANCH_ID RIGHT JOIN PROF_COMPANY_DEPARTMENTS ON PROF_GENERAL_DEPARTMENT.GENERAL_DEPT_ID = PROF_COMPANY_DEPARTMENTS.GENERAL_DEPT_ID RIGHT JOIN PROF_TREE_DETAILS ON PROF_COMPANY_DEPARTMENTS.COMPANY_DEPT_ID = PROF_TREE_DETAILS.COMPANY_DEPT_ID RIGHT JOIN PROF_EMPLOYEE_DATA ON PROF_EMPLOYEE_DATA.TREE_ID = PROF_TREE_DETAILS.TREE_ID LEFT JOIN PROF_JOBS_DETAILS ON PROF_JOBS_DETAILS.JOB_ID = PROF_EMPLOYEE_DATA.JOB_ID inner JOIN PROF_TASKS ON PROF_EMPLOYEE_DATA.EMPLOYEE_ID = PROF_TASKS.EMPLOYEE_ID where PROF_BRANCHES_DETAILS.BRANCH_ID = 15 and prof_general_department.general_dept_id = 163 and PROF_COMPANY_DEPARTMENTS.COMPANY_DEPT_ID = 333 AND PROF_TREE_DETAILS.TREE_ID = 571 AND (PROF_EMPLOYEE_DATA.EMP_NAME_AR IS NOT NULL) AND (PROF_EMPLOYEE_DATA.SHIFT_ID IS NOT NULL) and PROF_EMPLOYEE_DATA.action_id=1 AND PROF_EMPLOYEE_DATA.TREE_ID is not null AND PROF_EMPLOYEE_DATA.IS_DELETED=0
"GETEMPLOYEE_MASSIONDAYS": - " %s: недопустимый идентификатор"