Oracle Schema Objects——Tables——TableType
Oracle Schema Objects
Object Tables
?
| ?object type |
Oracle 對(duì)象類型是具有名稱、 屬性、和方法的用戶定義類型。
對(duì)象類型使得對(duì)現(xiàn)實(shí)世界中的實(shí)體(如客戶和采購(gòu)單等),作為對(duì)象在數(shù)據(jù)庫(kù)中進(jìn)行建模成為可能。 ?
對(duì)象類型定義邏輯結(jié)構(gòu),但不會(huì)創(chuàng)建存儲(chǔ)。 |
| 創(chuàng)建對(duì)象類型 | CREATE TYPE department_typ AS OBJECT |
| 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'); ?
CREATE TABLE 語(yǔ)句創(chuàng)建一個(gè)名為 departments_obj_t 的對(duì)象表,其對(duì)象類型為 department_typ 。
此表的屬性 (列) 派生自該對(duì)象類型的定義
使用INSERT 語(yǔ)句將行插入到此表。 |
?
?
?
Temporary Tables
| temporary tables |
Oracle 數(shù)據(jù)庫(kù)的 臨時(shí)表,用于存放只存在于某個(gè)事務(wù)或會(huì)話期間的數(shù)據(jù)。
臨時(shí)表中的數(shù)據(jù)是會(huì)話私有的,這意味著每個(gè)會(huì)話只可以查看和修改自己的數(shù)據(jù)。
臨時(shí)表對(duì)于必須緩沖中間結(jié)果集的應(yīng)用程序非常有用。
|
| Temporary Table Creation 創(chuàng)建臨時(shí)表 |
使用 CREATE GLOBAL TEMPORARY TABLE 語(yǔ)句創(chuàng)建一個(gè)臨時(shí)表。
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 ? 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)文件)。 ?
|
轉(zhuǎn)載于:https://www.cnblogs.com/thescentedpath/p/7069368.html
總結(jié)
以上是生活随笔為你收集整理的Oracle Schema Objects——Tables——TableType的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: Android 调用原生API获取地理位
- 下一篇: Kotlin基础-扩展