oracle-Object Table

Source: Internet
Author: User

Http://www.blogjava.net/decode360/archive/2008/10/16/286802.html


Create or replace type Person as Object (
Name VARCHAR2 (10),
Sex VARCHAR2 (2),
Birthday date,
Age Number (2)
);

Two ways to create object tables

First
CREATE TABLE T (
Person_col person,
emp_id number,
DEP_ID number
);

Second

CREATE table t of person;

Delete from T;
INSERT into T values (' ww ', ' f ', sysdate-1,23);
INSERT into t values (' ni ', ' m ', sysdate-2,24);
INSERT into T values (' SS ', ' F ', sysdate-3,25);


INSERT INTO T VALUES (
Person (' Zhang San ', ' Male ', sysdate-1,23),
100,
10);

INSERT INTO T VALUES (
Person (' Zhang Si ', ' female ', sysdate-2,44),
101,
11);

INSERT INTO T VALUES (
Person (' wo ', ' fe ', sysdate-3,44),
102,
11);
INSERT INTO T VALUES (
Person (' ni ', ' f ', sysdate-4,45),
103,
12);
Delete from t where emp_id=101;

You can see the content in Sqlplus using the following statement
select * from T;

However, the value of the Person_col column is not visible in Sqldeveloper, which is the following value

[KYC_ACC. Person] 102 11
[KYC_ACC. Person] 103 12

Be sure to use aliases or cause ambiguity (schema name)
Select T1.person_col.age from T t1;

oracle-Object Table

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.