Insert value into table with nested type colunm : Nested Tables « Collections « Oracle PL/SQL Tutorial

Oracle PL/SQL Tutorial
1. Introduction
2. Query Select
3. Set
4. Insert Update Delete
5. Sequences
6. Table
7. Table Joins
8. View
9. Index
10. SQL Data Types
11. Character String Functions
12. Aggregate Functions
13. Date Timestamp Functions
14. Numerical Math Functions
15. Conversion Functions
16. Analytical Functions
17. Miscellaneous Functions
18. Regular Expressions Functions
19. Statistical Functions
20. Linear Regression Functions
21. PL SQL Data Types
22. PL SQL Statements
23. PL SQL Operators
24. PL SQL Programming
25. Cursor
26. Collections
27. Function Procedure Packages
28. Trigger
29. SQL PLUS Session Environment
30. System Tables Data Dictionary
31. System Packages
32. Object Oriented
33. XML
34. Large Objects
35. Transaction
36. User Privilege
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Oracle PL/SQL Tutorial » Collections » Nested Tables 
26. 8. 6. Insert value into table with nested type colunm
SQL>
SQL>
SQL> create table courses
  2  code        VARCHAR2(6)
  3  , description VARCHAR2(30)
  4  , category    CHAR(3)
  5  , duration    NUMBER(2)) ;

Table created.

SQL>
SQL>
SQL> insert into courses values('SQL','SQL course',    'GEN',4);

row created.

SQL> insert into courses values('OAU','Oracle course', 'GEN',1);

row created.

SQL> insert into courses values('JAV','Java course',   'BLD',4);

row created.

SQL> insert into courses values('PLS','PL/SQL course', 'BLD',1);

row created.

SQL> insert into courses values('XML','XML course',    'BLD',2);

row created.

SQL> insert into courses values('ERM','ERM course',    'DSG',3);

row created.

SQL> insert into courses values('PMT','UML course',    'DSG',1);

row created.

SQL> insert into courses values('RSD','C# course',     'DSG',2);

row created.

SQL> insert into courses values('PRO','C++ course',    'DSG',5);

row created.

SQL> insert into courses values('GEN','GWT course',    'DSG',4);

row created.

SQL>
SQL>
SQL> create type errorNumberType as object
  2  code varchar2(4)
  3  , ch   number(2)
  4  , pg   number(3)
  5  , txt  varchar2(40)
  6  ;
  7  /

Type created.

SQL>
SQL> create type errorNumberTableCollection as table of errorNumberType;
  2  /

Type created.

SQL>
SQL> create table c as select from courses;

Table created.

SQL>
SQL> alter table c
  2  add (errata errorNumberTableCollection)
  3  nested table errata store as errata_tab;

Table altered.

SQL>
SQL> update c
  2  set    errata = errorNumberTableCollection();

10 rows updated.

SQL>
SQL>
SQL> insert into table select errata from where  code = 'SQL' )
  2  values 'SQL' , 45 'Typo in last line.' );

row created.

SQL>
SQL> drop table courses;

Table dropped.

SQL> drop table c;

Table dropped.

SQL> drop type errorNumberTableCollection force;

Type dropped.

SQL> drop type errorNumberType    force;

Type dropped.

SQL>
26. 8. Nested Tables
26. 8. 1. Nested Tables
26. 8. 2. Deleting internal elements from a collection
26. 8. 3. Creating a Nested Table Type
26. 8. 4. ANSI Support for Nested Tables
26. 8. 5. Nested type column
26. 8. 6. Insert value into table with nested type colunm
26. 8. 7. cardinality
26. 8. 8. Table with subquery
26. 8. 9. Type alias for user-defined type in select statement
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.