[每日一题] OCP1z0-047 :2013-07-27 外部表――不能被DML和建索引
首先看官方文档上的解释:
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和建索引的更多相关文章
- 【鬼畜】UVA - 401每日一题·猛男就是要暴力打表
管他什么rev数组,msg数组简化代码 #define _CRT_SECURE_NO_WARNINGS #include <cmath> #include <iostream> ...
- 老男孩IT教育-每日一题汇总
老男孩IT教育-每日一题汇总 第几天 第几周 日期 快速访问链接 第123天 第二十五周 2017年8月25日 出现Swap file….already exists以下错误如何解决? 第122天 2 ...
- PL/SQL Challenge 每日一题:2014-3-14 11gR2中带RELIES_ON子句的RESULT_CACHE函数
PL/SQL Challenge 每日一题:2014-3-14 11gR2中带RELIES_ON子句的RESULT_CACHE函数 最先答对且答案未经编辑的puber将获得纪念章一枚(答案不可编辑但可 ...
- 【剑指Offer】简单部分每日五题 - Day 1
今天开始更新leetcode上<剑指Offer>的题解,先从简单难度开始.预计按下列顺序更新: 简单难度:每日5题 中等难度:每日3题 困难难度:每日1题 17 - 打印从1到最大的n位数 ...
- LeetCode 每日一题「判定字符是否唯一」
我是陈皮,一个在互联网 Coding 的 ITer,微信搜索「陈皮的JavaLib」第一时间阅读最新文章,回复[资料],即可获得我精心整理的技术资料,电子书籍,一线大厂面试资料和优秀简历模板. 题目 ...
- 【Java每日一题】20170106
20170105问题解析请点击今日问题下方的"[Java每日一题]20170106"查看(问题解析在公众号首发,公众号ID:weknow619) package Jan2017; ...
- 【Java每日一题】20170105
20170104问题解析请点击今日问题下方的"[Java每日一题]20170105"查看(问题解析在公众号首发,公众号ID:weknow619) package Jan2017; ...
- 【Java每日一题】20170104
20170103问题解析请点击今日问题下方的"[Java每日一题]20170104"查看(问题解析在公众号首发,公众号ID:weknow619) package Jan2017; ...
- 【Java每日一题】20170103
20161230问题解析请点击今日问题下方的"[Java每日一题]20170103"查看(问题解析在公众号首发,公众号ID:weknow619) package Jan2017; ...
随机推荐
- [MVC4-基礎] 連動DropDownList - 使用jQuery、JSON
剛開始學MVC4,以下是一些基礎的學習筆記! 先展示一下結果: 1.選擇申請部門 2.選好後申請部門鎖住防止USER修改並載入該部門所擁有的設備類型 一.資料庫 dept mf_fx 二.View ( ...
- FpSpread添加标注
先看效果 实现: FarPoint.Web.Spread.StyleInfo Errorcss = new FarPoint.Web.Spread.StyleInfo(); Errorcss.Bord ...
- SQL 增加或删除一列
SQL 增加或删除一列 alter table tablename drop column columnname;alter table tabelname add columnname varcha ...
- Jobs定时器 - Quartz
Quartz是OpenSymphony开源组织在Job scheduling领域又一个开源项目,它可以与J2EE与J2SE应用程序相结合也可以单独使用.Quartz可以用来创建简单或为运行十个,百个, ...
- Maybe I go too extreme
昨天拖着一个没睡好的身体去面试了2家公司 被问到Collection的子集的时候顿时傻了一会,明明很简单的问题一时就想不起来了,哈哈.果然做it的人身体要顾好,状态太差了. 发现了一个问题,其实也是早 ...
- hdu Red and Black
算法:深搜 题意:就是让你找到一共可以移动多少次,每次只能移到黑色格子上, Problem Description There is a rectangular room, covered with ...
- zeromq源码分析笔记之无锁队列ypipe_t(3)
在上一篇中说到了mailbox_t的底层实际上使用了管道ypipe_t来存储命令.而ypipe_t实质上是一个无锁队列,其底层使用了yqueue_t队列,ypipe_t是对yueue_t的再包装,所以 ...
- 不同频率下的pwm配置
200k //PWM1 PWMPERDL1=0xb3; PWMPERDH1= 0x00; PWMCCNTL1=0x6B; PWMCCNTH1= ; PWMDBDY1=0x2B; //死区延时计时器 / ...
- VC++下使用SQLite数据库
老师最近给的上机题目有点变态,特别是写到最后,是需要写学生管理系统.如果C语言结合文件来操作的话,估计会比较麻烦(对文件里字符串的增删改查我都没有什么好点的算法).那就用数据库吧,我很自然的想到. 前 ...
- 动态编译添加php模块
注意:转载请注明出处:http://www.programfish.com/blog/?p=85 在很多时候我们用linux里搭建web服务器的时候会需要编译安装php套件,而在编译安装后可能又会需要 ...