我有一个包,我创建了一个这样的函数
创建或替换包pk_server_control是function fn_get_employees_by_consultant(consultant_id number)返回号码;结束;———-…
试试这个
create or replace package pk_server_control is function fn_get_employees_by_consultant(consultant_id number) return number; end; ----------------------------------------------------------------- create or replace package body pk_server_control is function fn_get_employees_by_consultant(consultant_id number) return number is val number := consultant_id; cursor employees is select c.CST_NAME, a.NO_OF_EMPLOYEES from NISHAN_LDS_ACCOUNT a join NISHAN_LDS_CONSULTANT c on c.CONSULTANT_ID = a.FK1_CONSULTANT_ID where c.CONSULTANT_ID =val; total number := 0; begin for data in employees loop total := total + data.NO_OF_EMPLOYEES; end loop; return total; end; end; begin dbms_output.put_line(pk_server_control.fn_get_employees_by_consultant(3)); end;