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