データベースからデータを取得しようとしていますが、コードにエラーが見つかりません:
declare
cursor c1 is select * from(select d.department_ID, d.department_name,count(d.department_name) cnt from emp e,dept d where e.department_id=d.department_id group by d.department_ID, d.department_name) where cnt>=5;
TYPE cust_dept IS RECORD(dept_id dept.department_id%type,dept_name dept.department_name%type,emp_name emp.first_name%type);
begin
FOR i IN c1
loop
select * into cust_dept from emp e, dept d where d.department_ID=i.department_ID;
DBMS_OUTPUT.put_line('Department_id :'||i.department_id||' '||'department_name :'||i.department_name);--||' '||'customer_name :'||cust_dept.emp_name);
--FETCH customer_cur into customer_rec;
--EXIT WHEN customer_cur%notfound;
--DBMS_OUTPUT.put_line(i.department_id);
END LOOP;
end;
/
エラーは次のとおりです。
ORA-06550: line 10, column 23:
PLS-00321: expression 'CUST_DEPT' is inappropriate as the left hand side of an assignment statement
ORA-06550: line 10, column 34:
PL/SQL: ORA-00904: : invalid identifier
ORA-06550: line 10, column 9:
PL/SQL: SQL Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action: