词条 | Structured type |
释义 |
The 1999 standard introduced a number of object-relational database features into SQL, chiefly among them structured user-defined types, usually called just structured types. These can be defined either in plain SQL with Structured types are supported to varying degrees in Oracle database, IBM DB2, PostgreSQL and Microsoft SQL Server, although the latter only allows structured types defined in CLR. SQL examplesObject structured typeIn order to define a custom structure type using Oracle database one could use statements such as these: CREATE TYPE Person_Type AS OBJECT ( person_title VARCHAR2(10), person_first_name VARCHAR2(20), person_last_name VARCHAR2(20), ) NOT FINAL; Such structure type can be then used to create a table that would also hold all columns defined in Person_Type:CREATE TABLE Person_Table OF Person_Type; NOT FINAL statement must be however included in a base structure type definition in order to allow for creation of any other subtypes.CREATE TYPE Student_Type UNDER Person_Type ( ); CREATE TABLE Student_Table OF Student_Type ( matriculation_number PRIMARY KEY, CONSTRAINT person_title_not_null_constraint NOT NULL (person_title), ); CREATE TYPE Address_Type AS OBJECT ( address_street VARCHAR2(30), address_city VARCHAR2(30), ); CREATE TYPE University AS OBJECT ( university_name VARCHAR2(30), university_address Address_Type ); Further reading
1 : SQL |
随便看 |
|
开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。