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

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Oracle Schema Objects——Tables——TableType

發(fā)布時間:2023/12/10 编程问答 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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.

對象類型定義邏輯結構,但不會創(chuàng)建存儲

創(chuàng)建對象類型

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.

對象表是一種特殊的表,其中每一行表示一個對象

?

創(chuàng)建對象表

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 語句創(chuàng)建一個名為 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.
    • 例如,一個計劃應用程序使學生可以創(chuàng)建可選的學期課程計劃。
    • 每個課程計劃由臨時表中的一行表示。
    • 在會話期間,課程計劃數據是私有的。
    • 當某個學生確定了課程計劃,應用程序會將其所選計劃移入永久表。
    • 在會話結束時,臨時表中的課程計劃數據將被自動刪除。

Temporary Table Creation

創(chuàng)建臨時表

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

使用 CREATE GLOBAL TEMPORARY TABLE 語句創(chuàng)建一個臨時表。

      • 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 數據庫中創(chuàng)建一個臨時表時,你只創(chuàng)建其靜態(tài)表定義

臨時表是在數據字典中所描述的一個持久對象,但在您的會話向表中插入數據之前,表顯示為空。

你是在為數據庫本身創(chuàng)建一個臨時表,而不是為每個 PL/SQL 存儲過程。

因為臨時表是靜態(tài)定義的,您可以使用 CREATE INDEX 語句為其創(chuàng)建索

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

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.

與永久表類似,臨時表被定義在數據字典中。

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

相反,臨時段是在第一次插入數據時分配的

在一個會話中加載數據之前,表顯示為空。

對特定事務的臨時表,臨時段在事務結束時釋放空間,而對特定于會話的臨時表,在會話結束時釋放空間。

?

?

?

?

?

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.

您可以創(chuàng)建一個外部表,把這個文件復制到外部表定義中指定的位置,并使用 SQL 查詢該文本文件中的記錄。

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

外部表對于在數據倉庫環(huán)境中執(zhí)行常見的 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.

數據庫內部,創(chuàng)建一個外部表意味著在數據字典中創(chuàng)建元數據

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 訪問驅動程序創(chuàng)建的。

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 數據文件(,而只是普通操作系統(tǒng)文件)。

?

?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 驅動程序創(chuàng)建、 更新、或追加數據到外部文

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.

創(chuàng)建外部文件后,無法更新或將追加數據到外部文件。

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

總結

以上是生活随笔為你收集整理的Oracle Schema Objects——Tables——TableType的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。