DECLARE
v_department_name VARCHAR(50);
v_department_manager VARCHAR(50);
v_totalsalary NUMBER(5);
BEGIN
SELECT departments.department_name, concat(employees.first_name, employees.last_name), sum(employees.salary)
INTO v_department_name, v_department_manager, v_totalsalary
FROM employees LEFT JOIN departments ON employees.department_id =departments.department_id WHERE departments.department_id = 100;
DBMS_OUTPUT.PUT_LINE ('Department Name is: ' || v_department_name || 'And Department Manager is: ' || v_department_manager || 'Total Amount of Salary is: ' || v_totalsalary);
END;
當試圖以顯示部門名稱,部門經理(名字,姓氏),並通過 員工的部門ID 100賺工資的總量,我得到這個:加入SQL查詢提供了ORA-00937錯誤
ORA-00937:不是單組分組函數
是什麼原因造成的錯誤?
表的員工(僱員標識,名字,姓氏,部門標識,經理標識,薪水)
表部門(部門標識,部門名稱,經理標識,LOCATION_ID)
不要讓我們陷入懸念!什麼是錯誤!? –
ORA-00937錯誤:不是單組功能 – kago
其他人發佈了另一個關於同一作業分配的問題(在代碼中有不同的錯誤)。我解釋瞭如何解決這個問題。 https://stackoverflow.com/questions/44709714/pl-sql-sql-statement-ignored-and-missing-right-parenthesis/44709768?noredirect=1#comment76404070_44709768 – mathguy