Returns a multiline record using a function (Function + cursor)

Source: Internet
Author: User
-- Compile a function to obtain empno, ename, Sal, and deptnodrop type emp_row_type in the employee information table; -- 1. Define the Data Type of a set. Create or replace type emp_row_type as object (empno number, ename varchar2 (10), Sal number (), deptno number); -- 2, define the data type of an array of types. You can continuously output the (Table type) Create or replace type emp_table_type as table of emp_row_type; -- 3, create a function, create or replace function getempreturnemp_table_type pipelinedasv emp_row_type; begin for my_row in (select empno, ename, Sal, deptno from Scott. EMP) loop V: = emp_row_type (my_row.empno, my_row.ename, my_row.sal, my_row.deptno); pipe row (V); End loop; return; end;

About copying a table structure

Create Table temp as select * from Scott. EMP where 1 = 2;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.