答案 0 :(得分:1)
应该是
DECLARE
v_manager_id NUMBER;
BEGIN
SELECT MANAGER_ID
INTO v_manager_id
FROM DEPARTMENTS
GROUP BY MANAGER_ID
HAVING COUNT(MANAGER_ID) > 1;
END;
或者,如果您需要count(manager_id)
的值,则必须声明一个变量,例如
DECLARE
v_manager_id NUMBER;
v_count NUMBER
BEGIN
SELECT MANAGER_ID, COUNT(MANAGER_ID)
INTO v_manager_id, v_count
FROM DEPARTMENTS
GROUP BY MANAGER_ID
HAVING COUNT(MANAGER_ID) > 1;
END;