Oracle nested table

Source: Internet
Author: User
Tags dname
========================================================== ============================= Nested table test ========================== ========================================================== = Author: tsmld (http://tsmld.itpub.net)
Posted at: 2006.12.05
Category: Database
Source: http://tsmld.itpub.net/post/19744/234628
----------------------------------------------------------------- Nested table

-- Create an object type

Create or replace type emp_type as object (
Name varchar2 (10), salary number (6, 2 ),
Hiredate date );
/

-- Create a nested table Type
Create or replace type emp_array is table of emp_type;
/

-- Create a table

Create Table Department (
Deptno number (2), dname varchar2 (10 ),
Employee emp_array
) Nested table employee store as employee;
/
-- Insert data
Insert into Department values (10, 'sales', emp_array (
Emp_type ('Scott ', 1000, sysdate ),
Emp_type ('Smith ', 1200, sysdate ),
Emp_type ('bucke', 1500, sysdate ))
);
-- Query
Select D. dname, E. Name, E. Salary
From department d, table (D. Employee) E

Reference: <Oracle 9i Pro * C/C ++>

 

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.