我试图从使用两个表(员工和部门)的函数中返回%rowtype多个值,但对我不起作用。, N+ j5 t- w1 R! k9 d7 _7 y
create or replace function get_employee (loc in number)return mv_emp%rowtypeas emp_record mv_emp%rowtype;begin select a.first_name,a.last_name,b.department_name into emp_record from employees a,departments b where a.department_id=b.department_id and location_id=loc; return(emp_record); end; ( Q: C. }. ]' S& C 解决方案: 7 _+ R; }" x. x
上面的函数编译没有任何错误?是什么类型的MV_EMP?理想情况下,它应该如下。 9 u/ s" U) F6 z& O6 ]5 y" _' Bcreate or replace type emp_type(first_name varchar2(20),last_name varchar2(20),depart_name varchar2(20))/create or replace function get_employee (loc in number)return emp_typeas emp_record emp_type;begin select a.first_name,a.last_name,b.department_name into emp_record from employees a,departments b where a.department_id=b.department_id and location_id=loc; return(emp_record); end;