首先看官方文档上的解释:

Managing External Tables

Oracle Database allows you read-only access to data in external tables. External tables are definedas tables that do not reside in the database, and can be in any format forwhich an access driver is provided. By providing the database with metadatadescribing an external table, the database is able to expose the data in theexternal table as if it were data residing in a regular database table. Theexternal data can be queried directly and in parallel using SQL.

You can, for example, select, join, or sort externaltable data. You can also create views and synonyms for external tables.However, no DML operations (UPDATE, INSERT, or DELETE) are possible, and no indexes can be created, on external tables.

External tables also provide a framework to unload theresult of an arbitrary SELECT statement into aplatform-independent Oracle-proprietary format that can be used by Oracle DataPump.

实验测试:

1、 创建一个外部表

(1)元数据:

[oracle@mydb ~]$more prod_master.dat

6,6,6,6,6,600

7,7,7,7,7,700

(2) 建目录

sys@OCM> create directory dir_gyj as '/home/oracle';

Directory created.

sys@OCM> grant read,write on directory dir_gyj to gyj;

Grant succeeded.

(3)创建外部表

gyj@OCM> CREATE TABLE ext_gyj_costs
2 (
3 "CHANNEL_ID" NUMBER,
4 "PROD_ID" NUMBER,
5 "PROMO_ID" NUMBER,
6 "TIME_ID" NUMBER,
7 "UNIT_COST" NUMBER,
8 "UNIT_PRICE" NUMBER
9 )
10 ORGANIZATION external
11 (
12 TYPE oracle_loader
13 DEFAULT DIRECTORY dir_gyj
14 ACCESS PARAMETERS
15 (
16 FIELDS TERMINATED BY "," LDRTRIM
17 REJECT ROWS WITH ALL NULL FIELDS
18 (
19 "CHANNEL_ID" CHAR(255)
20 TERMINATED BY ",",
21 "PROD_ID" CHAR(255)
22 TERMINATED BY ",",
23 "PROMO_ID" CHAR(255)
24 TERMINATED BY ",",
25 "TIME_ID" CHAR(255)
26 TERMINATED BY ",",
27 "UNIT_COST" CHAR(255)
28 TERMINATED BY ",",
29 "UNIT_PRICE" CHAR(255)
30 TERMINATED BY ","
31 )
32 )
33 location
34 (
35 'prod_master.dat'
36 )
37 )REJECT LIMIT UNLIMITED; Table created. gyj@OCM> select * from ext_gyj_costs; CHANNEL_ID PROD_ID PROMO_ID TIME_ID UNIT_COST UNIT_PRICE
---------- ---------- ---------- ---------- ---------- ----------
6 6 6 6 6 600
7 7 7 7 7 700

2、   对外部表做DML,操作如下,说明外部表不支持DML

gyj@OCM> Update  ext_gyj_costs set UNIT_PRICE=800 where channel_id=6;
Update ext_gyj_costs set UNIT_PRICE=800 where channel_id=6
*
ERROR at line 1:
ORA-30657: operation not supported on external organized table gyj@OCM> delete from ext_gyj_costs where channel_id=6;
delete from ext_gyj_costs where channel_id=6
*
ERROR at line 1:
ORA-30657: operation not supported on external organized table

3、  在外部表上建视图和同义词

gyj@OCM> Create view v_cost as select * from ext_gyj_costs;

View created.

gyj@OCM> select * from v_cost;

CHANNEL_ID    PROD_ID   PROMO_ID    TIME_ID  UNIT_COST UNIT_PRICE
---------- ---------- ---------- ---------- ---------- ----------
6 6 6 6 6 600
7 7 7 7 7 700 gyj@OCM> create synonym s_cost for ext_gyj_costs; Synonym created. gyj@OCM> select * from s_cost; CHANNEL_ID PROD_ID PROMO_ID TIME_ID UNIT_COST UNIT_PRICE
---------- ---------- ---------- ---------- ---------- ----------
6 6 6 6 6 600
7 7 7 7 7 700

4、 对外部表建索引,不支操作

gyj@OCM> create index idx_chaannel_id on ext_gyj_costs(channel_id);
create index idx_chaannel_id on ext_gyj_costs(channel_id)
*
ERROR at line 1:
ORA-30657: operation not supported on external organized table

总结:外部表除了可以select(查询)、建视图,同义词,其它操作如DML,建索引等都不支持。

正确答案:C

[每日一题] OCP1z0-047 :2013-07-27 外部表――不能被DML和建索引的更多相关文章

  1. 【鬼畜】UVA - 401每日一题·猛男就是要暴力打表

    管他什么rev数组,msg数组简化代码 #define _CRT_SECURE_NO_WARNINGS #include <cmath> #include <iostream> ...

  2. 老男孩IT教育-每日一题汇总

    老男孩IT教育-每日一题汇总 第几天 第几周 日期 快速访问链接 第123天 第二十五周 2017年8月25日 出现Swap file….already exists以下错误如何解决? 第122天 2 ...

  3. PL/SQL Challenge 每日一题:2014-3-14 11gR2中带RELIES_ON子句的RESULT_CACHE函数

    PL/SQL Challenge 每日一题:2014-3-14 11gR2中带RELIES_ON子句的RESULT_CACHE函数 最先答对且答案未经编辑的puber将获得纪念章一枚(答案不可编辑但可 ...

  4. 【剑指Offer】简单部分每日五题 - Day 1

    今天开始更新leetcode上<剑指Offer>的题解,先从简单难度开始.预计按下列顺序更新: 简单难度:每日5题 中等难度:每日3题 困难难度:每日1题 17 - 打印从1到最大的n位数 ...

  5. LeetCode 每日一题「判定字符是否唯一」

    我是陈皮,一个在互联网 Coding 的 ITer,微信搜索「陈皮的JavaLib」第一时间阅读最新文章,回复[资料],即可获得我精心整理的技术资料,电子书籍,一线大厂面试资料和优秀简历模板. 题目 ...

  6. 【Java每日一题】20170106

    20170105问题解析请点击今日问题下方的"[Java每日一题]20170106"查看(问题解析在公众号首发,公众号ID:weknow619) package Jan2017; ...

  7. 【Java每日一题】20170105

    20170104问题解析请点击今日问题下方的"[Java每日一题]20170105"查看(问题解析在公众号首发,公众号ID:weknow619) package Jan2017; ...

  8. 【Java每日一题】20170104

    20170103问题解析请点击今日问题下方的"[Java每日一题]20170104"查看(问题解析在公众号首发,公众号ID:weknow619) package Jan2017; ...

  9. 【Java每日一题】20170103

    20161230问题解析请点击今日问题下方的"[Java每日一题]20170103"查看(问题解析在公众号首发,公众号ID:weknow619) package Jan2017; ...

随机推荐

  1. io系统

    一.浅谈io系统 io系统的结构化思想是:输入-转换流-装饰器-输出. 对于字节流来说,常见的结构类为: package com.handchina.yunmart.middleware.servic ...

  2. ios浅谈关于nil和 NIL区别及相关问题(转)

    转自:http://blog.csdn.net/guozh/article/details/8469131 个就是将引用技术减1,所谓的引用计数就是看看有多个指针指向一块内存实体,当release一次 ...

  3. asp.net操作xml(增删查改)

    asp.net操作xml 1.xml文档Products.xml <?xml version="1.0" encoding="utf-8"?> &l ...

  4. javascript系统时间

    <div>                <%--系统时间--%>                当前时间是:                <script type=& ...

  5. Android原生Calendar代码阅读(一)

    原生Calendar代码: 5.0Calendar源码.rar 提取的JavaDoc: Calendar的javadoc.rar 1. AsyncQueryService和AsyncQueryServ ...

  6. Windows命令行(DOS命令)教程–2 (转载) http://arch.pconline.com.cn//pcedu/rookie/basic/10111/15325_1.html

    二.符号约定 为了便于说明格式,这里我们使用了一些符号约定,它们是通用的: C: 盘符 Path 路径 Filename 文件名 .ext 扩展名 Filespec 文件标识符 [ ] 方括号中的项目 ...

  7. 支付宝SDK快速入口链接

    支付宝快捷支付SDK官方网站

  8. windows下自动删除n天前的文件

    使用windows2003下的内置命令forfiles配合计划任务可以实现自动删除n天前的文件. windows2003中设定自动执行的计划任务很简单. 一.脚本编写 forfiles命令用法: Fo ...

  9. jquery交替实现隐藏、显示

      <html>   <head>   <title></title>   </head>   <script src="j ...

  10. Form 表单常用正则验证 (收藏)

    1.^\d+$ //匹配非负整数(正整数 + 0) 2.^[0-9]*[1-9][0-9]*$ //匹配正整数 3.^((-\d+)|(0+))$ //匹配非正整数(负整数 + 0) 4.^-[0-9 ...