Oracle Schema Objects——Tables——TableType

Oracle Schema Objects

Object Tables

 

 object type

      • An Oracle object type is a user-defined type with a name, attributes, and methods.

Oracle 对象类型是具有名称、 属性、和方法的用户定义类型。

      • Object types make it possible to model real-world entities such as customers and purchase orders as objects in the database.

对象类型使得对现实世界中的实体(如客户和采购单等),作为对象在数据库中进行建模成为可能。

 

      • An object type defines a logical structure, but does not create storage.

对象类型定义逻辑结构,但不会创建存储

创建对象类型

CREATE TYPE department_typ AS OBJECT
   ( d_name     VARCHAR2(100),
     d_address VARCHAR2(200) );
/

object table

An object table is a special kind of table in which each row represents an object.

对象表是一种特殊的表,其中每一行表示一个对象

 

创建对象表

CREATE TABLE departments_obj_t OF department_typ;

INSERT INTO departments_obj_t

VALUES ('hr', '10 Main St, Sometown, CA');

 

  • The CREATE TABLE statement creates an object table named departments_obj_t of the object type department_typ.

CREATE TABLE 语句创建一个名为 departments_obj_t 的对象表,其对象类型为 department_typ 。

  • The attributes (columns) of this table are derived from the definition of the object type.

此表的属性 (列) 派生自该对象类型的定义

  • The INSERT statement inserts a row into this table.

使用INSERT 语句将行插入到此表。

 

 

 

Temporary Tables

temporary tables

      • Oracle Database temporary tables hold data that exists only for the duration of a transaction or session.

Oracle 数据库的 临时表,用于存放只存在于某个事务或会话期间的数据。

      • Data in a temporary table is private to the session, which means that each session can only see and modify its own data.

临时表中的数据是会话私有的,这意味着每个会话只可以查看和修改自己的数据。

      • Temporary tables are useful in applications where a result set must be buffered.

临时表对于必须缓冲中间结果集的应用程序非常有用。

    • For example, a scheduling application enables college students to create optional semester course schedules.
    • Each schedule is represented by a row in a temporary table. During the session, the schedule data is private.
    • When the student decides on a schedule, the application moves the row for the chosen schedule to a permanent table.
    •  At the end of the session, the schedule data in the temporary data is automatically dropped.
    • 例如,一个计划应用程序使学生可以创建可选的学期课程计划。
    • 每个课程计划由临时表中的一行表示。
    • 在会话期间,课程计划数据是私有的。
    • 当某个学生确定了课程计划,应用程序会将其所选计划移入永久表。
    • 在会话结束时,临时表中的课程计划数据将被自动删除。

Temporary Table Creation

创建临时表

      • The CREATE GLOBAL TEMPORARY TABLE statement creates a temporary table.

使用 CREATE GLOBAL TEMPORARY TABLE 语句创建一个临时表。

      • The ON COMMIT clause specifies whether the table data is transaction-specific (default) or session-specific.

ON COMMIT 子句指定表中的数据是特定于事务 (默认值),还是特定于

 

Unlike temporary tables in some other relational databases, when you create a temporary table in an Oracle database, you create a static table definition. The temporary table is a persistent object described in the data dictionary, but appears empty until your session inserts data into the table. You create a temporary table for the database itself, not for every PL/SQL stored procedure.

Because temporary tables are statically defined, you can create indexes for them with the CREATE INDEX statement. Indexes created on temporary tables are also temporary. The data in the index has the same session or transaction scope as the data in the temporary table. You can also create a view or trigger on a temporary table.

 

与其它一些关系数据库中的临时表不同,当你在 Oracle 数据库中创建一个临时表时,你只创建其静态表定义

临时表是在数据字典中所描述的一个持久对象,但在您的会话向表中插入数据之前,表显示为空。

你是在为数据库本身创建一个临时表,而不是为每个 PL/SQL 存储过程。

因为临时表是静态定义的,您可以使用 CREATE INDEX 语句为其创建索

临时表上创建的索引也是临时的。在索引中的数据与临时表中的数据具有相同的会话或事务范围。您还可以在临时表上创建一个视图或触发器。

Segment Allocation in Temporary Tables

临时表中的段分配

Like permanent tables, temporary tables are defined in the data dictionary. Temporary segments are allocated when data is first inserted. Until data is loaded in a session the table appears empty. Temporary segments are deallocated at the end of the transaction for transaction-specific temporary tables and at the end of the session for session-specific temporary tables.

与永久表类似,临时表被定义在数据字典中。

但是,临时表和他们的索引不会在创建时自动分配段

相反,临时段是在第一次插入数据时分配的

在一个会话中加载数据之前,表显示为空。

对特定事务的临时表,临时段在事务结束时释放空间,而对特定于会话的临时表,在会话结束时释放空间。

 

 

 

 

 

External Tables

external table

An external table accesses data in external sources as if this data were in a table in the database. You can use SQL, PL/SQL, and Java to query the external data.

外部表访问外部数据源中的数据,如同此数据是在数据库中的表中一样。您可以使用 SQL PL/SQL、和 Java 查询外部数据。

 

External tables are useful for querying flat files. For example, a SQL-based application may need to access records in a text file. The records are in the following form:

外部表可用于查询平面文件。例如,一个基于 SQL 的应用程序,可能需要访问一个文本文件中的记录。记录的形式如下:

100,Steven,King,SKING,515.123.4567,17-JUN-03,AD_PRES,31944,150,90
101,Neena,Kochhar,NKOCHHAR,515.123.4568,21-SEP-05,AD_VP,17000,100,90
102,Lex,De Haan,LDEHAAN,515.123.4569,13-JAN-01,AD_VP,17000,100,90

 

You could create an external table, copy the file to the location specified in the external table definition, and use SQL to query the records in the text file.

您可以创建一个外部表,把这个文件复制到外部表定义中指定的位置,并使用 SQL 查询该文本文件中的记录。

External tables are also valuable for performing ETL tasks common in data warehouse environments.

外部表对于在数据仓库环境中执行常见的 ETL任务也是很有价值的

For example, external tables enable the pipelining of the data loading phase with the transformation phase, eliminating the need to stage data inside the database in preparation for further processing inside the database.

例如,外部表使得数据加载阶段和数据转换阶段对接,消除了为进一步处理数据库中的数据而在数据库内存放中间数据的需要。

External Table Creation

External Table Creation

Internally, creating an external table means creating metadata in the data dictionary.

数据库内部,创建一个外部表意味着在数据字典中创建元数据

Unlike an ordinary table, an external table does not describe data stored in the database, nor does it describe how data is stored externally.

与普通的表不同,外部表不描述存储在数据库中的数据,也不会描述数据在外部是如何存储的。

Rather, external table metadata describes how the external table layer must present data to the database.

外部表的元数据描述了外部表层必须如何提供数据给数据库

 

A CREATE TABLE ... ORGANIZATION EXTERNAL statement has two parts.

CREATE TABLE ... ORGANIZATION EXTERNAL 语句包含两部分.

 

The external table definition describes the column types.

外部表定义描述列类型

This definition is like a view that enables SQL to query external data without loading it into the database.

这个定义像一个视图,使您可以使用 SQL 查询外部数据,而不用将其加载到数据库。

The second part of the statement maps the external data to the columns.

该语句的第二部分将外部数据映射到列

 

External tables are read-only unless created with CREATE TABLE AS SELECT with the ORACLE_DATAPUMP access driver. 外部表是只读的,除非它是使用 CREATE TABLE AS SELECT ORACLE_DATAPUMP 访问驱动程序创建的。

Restrictions for external tables include no support for indexed columns, virtual columns, and column objects.

外部表有些限制,包括不支持索引列、 虚拟列、和列对象

External Table Access Drivers

外部表访问 驱动程序

External Table Access Drivers

外部表访问 驱动程序

An access driver is an API that interprets the external data for the database.

访问驱动程序是一个 API,它为数据库解释外部数据

The access driver runs inside the database, which uses the driver to read the data in the external table.

访问驱动程序在数据库内运行,数据库使用该驱动程序来读取外部表中的数据。

The access driver and the external table layer are responsible for performing the transformations required on the data in the data file so that it matches the external table definition.

访问驱动程序和外部表层负责对数据文件中的数据进行转换,使它与外部表定义匹配。

xternal Tables外部数据是如何被访问的

ORACLE_LOADER (default) and ORACLE_DATAPUMP access drivers

Oracle provides the ORACLE_LOADER (default) and ORACLE_DATAPUMP access drivers for external tables.

Oracle 为外部表提供了 ORACLE_LOADER(缺省)ORACLE_DATAPUMP 访问驱动程序

For both drivers, the external files are not Oracle data files.

对于这两个驱动程序来说,外部文件不是 Oracle 数据文件(,而只是普通操作系统文件)。

 

 ORACLE_LOADER (default)

ORACLE_LOADER enables read-only access to external files using SQL*Loader.

ORACLE_LOADER 允许通 SQL*Loader 对外部文件进行只读访问

You cannot create, update, or append to an external file using the ORACLE_LOADER driver.

您不能使用 ORACLE_LOADER 驱动程序创建、 更新、或追加数据到外部文

ORACLE_DATAPUMP access drivers

The ORACLE_DATAPUMP driver enables you to unload external data.

ORACLE_DATAPUMP 驱动程序使您能够 卸载外部数据

 

This operation involves reading data from the database and inserting the data into an external table, represented by one or more external files.

此操作包括从数据库读取数据,并将其插入到由一个或多个外部文件所代表的外部表中。

After external files are created, the database cannot update or append data to them.

创建外部文件后,无法更新或将追加数据到外部文件。

The driver also enables you to load external data, which involves reading an external table and loading its data into a database.

该驱动程序也使您能够加载外部数据,包括读取外部表并将其数据加载到数据库中。

转载于:https://www.cnblogs.com/thescentedpath/p/7069368.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/269106.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

利用局域网性能测试仪保障企业网络环境

现代社会网络的普及,已经致使人民已经离不开网络,无论是从工作、生活、基础设施等等网络应用到各行各业。而普及了网络,网络的质量就是最重要的一环。试想,网络的快与慢小到影响一个人的心情好坏,大的可以影响到企业业…

MySQL存储过程编程

http://www.drekey.cn/blog/archives/category/stored

Kotlin基础-扩展

/** 扩展:对既有的类增加新功能而无需继承该类,即无法获取其源代码* 主要作用:“立即”为相关类整体上添加“工具类”方法或属性* Kotlin支持:扩展函数,扩展属性**与接受者类中参数,名字都一样的扩展是无效的* 尽量避免…

电缆的验证、鉴定和认证应该选择什么测试工具

在电缆的测试安装时,有以下几种测试工具选择:验证、鉴定及认证。当您要进行电缆认证时,不同测试工具的部分功能会有重叠,但可以学习以下几个问题,以帮助您选择正确的测试工具。 (1)电缆验证测试…

项目管理改进实践

昨天我下载了一个专业的敏捷项目管理的软件——Mingle,研究了一天,基本会用了。 应为“专业”,所以不是免费的- -!不过还好。。。。6人以下可以使用免费的lisence。。。。 这是一次重要的项目管理改进实践…

Java:使用split方法时忽略中英文的符号区别

Java:使用split方法时忽略中英文的符号区别 split(",|,")

linux ubunt 安装软件的前期准备——更新源的更换

如果是高手,请翻到页面最下方,更换更新源的总结,直接操作即可 可能会优点啰嗦,但是认真看,一定能解决问题~~希望对大家有帮助~ 最近在熟悉linux环境,自己安装了一个ubuntu虚拟机。 很多朋友问装了ubuntu怎么…

以太网性能测试分析仪

如今,面对无数未上市的和已上市的应用,网络环境与设备的不同,企业网络的性能如何得到保障?企业网络如果不稳定,业务的中断、用户的流失都会给企业带来巨大的损失。一名合格的网络管理人员应该如何利用自己的专业知识还…

sql实现like多个值的查询

regexp_like (字段名,(条件1|条件2|条件3|条件4)) regexp_like (字段名, #{参数})

部署OCS后修改web farm地址

部署完OCS后如果要想修改OCS的web farm地址等,目前发现有两种方式。一种比较简单,但是要知道数据库的帐号,直接连接到OCS后端的RTCSConfig数据库,修改MSFT_SIPGroupExpansionSetting、MSFT_SIPDataMCUCapabilitySetting、MSFT_SIP…

mysql+mybatis递归调用

递归调用的应用场景常常出现在多级嵌套的情况,比如树形的菜单。下面通过一个简单的例子来实现mysqlmybatis的递归。 数据模型 private Integer categoryId;private String categoryName;private Integer isRoot;private Integer categoryLevel;private Integer root…

福禄克DSX2-5000测试仪为CAT 6A认证保驾护航

我们都知道CAT 6A是目前被认为支持(10 Gig)千兆以太网速度性能最高的双绞线布线,它已经存在了十多年。所以,你可能会惊讶地发现第6类(现在19岁了!)继续主导双绞线铜缆的销量第一名。 如果您查看…

一手指天,一手指地,开!

做了1年多的C#.NET的系统开发,我越来越觉得自个应该去写C逻辑程序。C#的语言更加重视的是如何去处理实现问题,如何去实现一种应用,这让我有点提不起劲,倒不是说高级语言的毛病,个人喜好而已。所以这段时间忙里偷闲&…

java.util.ComparableTimSort中的sort()方法简单分析

TimSort算法是一种起源于归并排序和插入排序的混合排序算法,设计初衷是为了在真实世界中的各种数据中能够有较好的性能。该算法最初是由Tim Peters于2002年在Python语言中提出的。 TimSort 是一个归并排序做了大量优化的版本号。对归并排序排在已经反向排好序的输入…

虚拟化运维工具对金融行业的解决方案

金融行业是一个专业领域,例如如医疗保健,需要以最大化的性能进行无中断运营。任何包括中断或降级在内的性能问题都是完全不可接受的。如果已经中断,后果将会是非常严重的。而明辰智航云安虚拟化网络与虚拟化性能管理系统可以帮助你尽可能的规…

简单说说通讯设备的热设计

从事通讯设备热设计工作8个月了,总体来说对这项工作有了些自己的认识。热设计成为一个专门的岗位在国内还没有多少年的历史,外企中,英特尔、思科、诺基亚、爱立信、山特电子等都有专门的岗位,国内企业,如华为、中兴、联…

使用DSX2-5000 CH测试时选择(+PoE)和(+All)后缀的含义

在测试双绞线布线时,需要在测试仪上设置一些关键的参数来测试永久链路符合行业标准参数,如插入损耗、NEXT、PSNEXT、ACR-N、PSACR-N、ACR-F、PSACR-F和回波损耗。在测试Cat 6A(或ISO11801标准的Fa类)时,我们还使用PSAN…

bat学习工具

BAT学习工具 最近开始学习批处理,整理了一下以下是3800的教程说明,和一些批处理教程的下载地址,附件是一个bat—exe的好软件VisualBat 1.08的,更新了exe—bat的转换教程到处都是,关键是自己要好好学习。亲密接触批处理…