日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

Oracle Schema Objects——Tables——TableType

發(fā)布時(shí)間:2023/12/10 编程问答 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Oracle Schema Objects——Tables——TableType 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

Oracle Schema Objects

Object Tables

?

?object type

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

Oracle 對(duì)象類型是具有名稱、 屬性、和方法的用戶定義類型。

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

對(duì)象類型使得對(duì)現(xiàn)實(shí)世界中的實(shí)體(如客戶和采購(gòu)單等),作為對(duì)象在數(shù)據(jù)庫(kù)中進(jìn)行建模成為可能。

?

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

對(duì)象類型定義邏輯結(jié)構(gòu),但不會(huì)創(chuàng)建存儲(chǔ)

創(chuàng)建對(duì)象類型

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.

對(duì)象表是一種特殊的表,其中每一行表示一個(gè)對(duì)象

?

創(chuàng)建對(duì)象表

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 語(yǔ)句創(chuàng)建一個(gè)名為 departments_obj_t 的對(duì)象表,其對(duì)象類型為 department_typ 。

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

此表的屬性 (列) 派生自該對(duì)象類型的定義

  • The INSERT statement inserts a row into this table.

使用INSERT 語(yǔ)句將行插入到此表。

?

?

?

Temporary Tables

temporary tables

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

Oracle 數(shù)據(jù)庫(kù)的 臨時(shí)表,用于存放只存在于某個(gè)事務(wù)或會(huì)話期間的數(shù)據(jù)。

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

臨時(shí)表中的數(shù)據(jù)是會(huì)話私有的,這意味著每個(gè)會(huì)話只可以查看和修改自己的數(shù)據(jù)。

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

臨時(shí)表對(duì)于必須緩沖中間結(jié)果集的應(yīng)用程序非常有用。

    • 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.
    • 例如,一個(gè)計(jì)劃應(yīng)用程序使學(xué)生可以創(chuàng)建可選的學(xué)期課程計(jì)劃。
    • 每個(gè)課程計(jì)劃由臨時(shí)表中的一行表示。
    • 在會(huì)話期間,課程計(jì)劃數(shù)據(jù)是私有的。
    • 當(dāng)某個(gè)學(xué)生確定了課程計(jì)劃,應(yīng)用程序會(huì)將其所選計(jì)劃移入永久表。
    • 在會(huì)話結(jié)束時(shí),臨時(shí)表中的課程計(jì)劃數(shù)據(jù)將被自動(dòng)刪除。

Temporary Table Creation

創(chuàng)建臨時(shí)表

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

使用 CREATE GLOBAL TEMPORARY TABLE 語(yǔ)句創(chuàng)建一個(gè)臨時(shí)表。

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

ON COMMIT 子句指定表中的數(shù)據(jù)是特定于事務(wù) (默認(rèn)值),還是特定于會(huì)

?

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.

?

與其它一些關(guān)系數(shù)據(jù)庫(kù)中的臨時(shí)表不同,當(dāng)你在 Oracle 數(shù)據(jù)庫(kù)中創(chuàng)建一個(gè)臨時(shí)表時(shí),你只創(chuàng)建其靜態(tài)表定義

臨時(shí)表是在數(shù)據(jù)字典中所描述的一個(gè)持久對(duì)象,但在您的會(huì)話向表中插入數(shù)據(jù)之前,表顯示為空。

你是在為數(shù)據(jù)庫(kù)本身創(chuàng)建一個(gè)臨時(shí)表,而不是為每個(gè) PL/SQL 存儲(chǔ)過(guò)程。

因?yàn)?/span>臨時(shí)表是靜態(tài)定義的,您可以使用 CREATE INDEX 語(yǔ)句為其創(chuàng)建索

臨時(shí)表上創(chuàng)建的索引也是臨時(shí)的。在索引中的數(shù)據(jù)與臨時(shí)表中的數(shù)據(jù)具有相同的會(huì)話或事務(wù)范圍。您還可以在臨時(shí)表上創(chuàng)建一個(gè)視圖或觸發(fā)器。

Segment Allocation in Temporary Tables

臨時(shí)表中的段分配

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.

與永久表類似,臨時(shí)表被定義在數(shù)據(jù)字典中。

但是,臨時(shí)表和他們的索引不會(huì)在創(chuàng)建時(shí)自動(dòng)分配段

相反,臨時(shí)段是在第一次插入數(shù)據(jù)時(shí)分配的

在一個(gè)會(huì)話中加載數(shù)據(jù)之前,表顯示為空。

對(duì)特定事務(wù)的臨時(shí)表,臨時(shí)段在事務(wù)結(jié)束時(shí)釋放空間,而對(duì)特定于會(huì)話的臨時(shí)表,在會(huì)話結(jié)束時(shí)釋放空間。

?

?

?

?

?

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.

外部表訪問(wèn)外部數(shù)據(jù)源中的數(shù)據(jù),如同此數(shù)據(jù)是在數(shù)據(jù)庫(kù)中的表中一樣。您可以使用 SQL PL/SQL、和 Java 查詢外部數(shù)據(jù)。

?

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:

外部表可用于查詢平面文件。例如,一個(gè)基于 SQL 的應(yīng)用程序,可能需要訪問(wèn)一個(gè)文本文件中的記錄。記錄的形式如下:

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.

您可以創(chuàng)建一個(gè)外部表,把這個(gè)文件復(fù)制到外部表定義中指定的位置,并使用 SQL 查詢?cè)撐谋疚募械挠涗洝?/span>

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

外部表對(duì)于在數(shù)據(jù)倉(cāng)庫(kù)環(huán)境中執(zhí)行常見的 ETL任務(wù)也是很有價(jià)值的

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.

例如,外部表使得數(shù)據(jù)加載階段和數(shù)據(jù)轉(zhuǎn)換階段對(duì)接,消除了為進(jìn)一步處理數(shù)據(jù)庫(kù)中的數(shù)據(jù)而在數(shù)據(jù)庫(kù)內(nèi)存放中間數(shù)據(jù)的需要。

External Table Creation

External Table Creation

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

數(shù)據(jù)庫(kù)內(nèi)部,創(chuàng)建一個(gè)外部表意味著在數(shù)據(jù)字典中創(chuàng)建元數(shù)據(jù)

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

與普通的表不同,外部表不描述存儲(chǔ)在數(shù)據(jù)庫(kù)中的數(shù)據(jù),也不會(huì)描述數(shù)據(jù)在外部是如何存儲(chǔ)的。

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

外部表的元數(shù)據(jù)描述了外部表層必須如何提供數(shù)據(jù)給數(shù)據(jù)庫(kù)

?

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

CREATE TABLE ... ORGANIZATION EXTERNAL 語(yǔ)句包含兩部分.

?

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.

這個(gè)定義像一個(gè)視圖,使您可以使用 SQL 查詢外部數(shù)據(jù),而不用將其加載到數(shù)據(jù)庫(kù)。

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

該語(yǔ)句的第二部分將外部數(shù)據(jù)映射到列

?

External tables are read-only unless created with CREATE TABLE AS SELECT with the ORACLE_DATAPUMP access driver. 外部表是只讀的,除非它是使用?CREATE TABLE AS SELECT ORACLE_DATAPUMP 訪問(wèn)驅(qū)動(dòng)程序創(chuàng)建的。

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

外部表有些限制,包括不支持索引列、 虛擬列、和列對(duì)象

External Table Access Drivers

外部表訪問(wèn) 驅(qū)動(dòng)程序

External Table Access Drivers

外部表訪問(wèn) 驅(qū)動(dòng)程序

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

訪問(wèn)驅(qū)動(dòng)程序是一個(gè) API,它為數(shù)據(jù)庫(kù)解釋外部數(shù)據(jù)

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

訪問(wèn)驅(qū)動(dòng)程序在數(shù)據(jù)庫(kù)內(nèi)運(yùn)行,數(shù)據(jù)庫(kù)使用該驅(qū)動(dòng)程序來(lái)讀取外部表中的數(shù)據(jù)。

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.

訪問(wèn)驅(qū)動(dòng)程序和外部表層負(fù)責(zé)對(duì)數(shù)據(jù)文件中的數(shù)據(jù)進(jìn)行轉(zhuǎn)換,使它與外部表定義匹配。

xternal Tables外部數(shù)據(jù)是如何被訪問(wèn)的

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 訪問(wèn)驅(qū)動(dòng)程序

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

對(duì)于這兩個(gè)驅(qū)動(dòng)程序來(lái)說(shuō),外部文件不是 Oracle 數(shù)據(jù)文件(,而只是普通操作系統(tǒng)文件)。

?

?ORACLE_LOADER (default)

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

ORACLE_LOADER 允許通過(guò) SQL*Loader 對(duì)外部文件進(jìn)行只讀訪問(wèn)

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

您不能使用 ORACLE_LOADER 驅(qū)動(dòng)程序創(chuàng)建、 更新、或追加數(shù)據(jù)到外部文

ORACLE_DATAPUMP access drivers

The ORACLE_DATAPUMP driver enables you to unload external data.

ORACLE_DATAPUMP 驅(qū)動(dòng)程序使您能夠 卸載外部數(shù)據(jù)

?

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

此操作包括從數(shù)據(jù)庫(kù)讀取數(shù)據(jù),并將其插入到由一個(gè)或多個(gè)外部文件所代表的外部表中。

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

創(chuàng)建外部文件后,無(wú)法更新或?qū)⒆芳訑?shù)據(jù)到外部文件。

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

該驅(qū)動(dòng)程序也使您能夠加載外部數(shù)據(jù),包括讀取外部表并將其數(shù)據(jù)加載到數(shù)據(jù)庫(kù)中。

轉(zhuǎn)載于:https://www.cnblogs.com/thescentedpath/p/7069368.html

總結(jié)

以上是生活随笔為你收集整理的Oracle Schema Objects——Tables——TableType的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。