Home  >  Article  >  Database  >  Oracle 方法返回集合类型[table]

Oracle 方法返回集合类型[table]

WBOY
WBOYOriginal
2016-06-07 17:27:51885browse

以scott.emp 为例,根据职位(MGR)编号,查出该职位编号的所有信息 先创建类型: 相当于每一行记录的类型 可以理解为 scott.emp%r

CREATE OR REPLACE FUNCTION fn_test1(num VARCHAR2)
RETURN mtab
IS
mytab mtab;
BEGIN
SELECT my_record(EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) BULK COLLECT INTO mytab FROM scott.emp WHERE mgr=num;
RETURN mytab;
END;

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn