oracle的普通视图不能创建索引,下面是一个测试。
oracle版本:Oracle9i Enterprise Edition Release 9.2.0.6.0
使用sale表,表结构如下:
SQL> desc sale;
Name Type Nullable Default Comments
—– ——- ——– ——- ——–
MONTH CHAR(6) Y
SELL NUMBER Y
表中内容如下:
SQL> select * from sale;
MONTH SELL
—— —-
200001 1000
200002 1100
200003 1200
200004 1300
200005 1400
200006 1500
200007 1600
200101 1100
200202 1200
200301 1300
200008 1000
11 rows selected
给sale表创建视图:
SQL> CREATE VIEW v_sale AS SELECT * FROM sale;
View created
看看刚刚创建视图的结构:
SQL> desc v_sale;
Name Type Nullable Default Comments
—– ——- ——– ——- ——–
MONTH CHAR(6) Y
SELL NUMBER Y
给表创建索引是没有疑问滴:
SQL> CREATE INDEX inx_t_sale on sale(month);
Index created
试试给视图创建索引可行不:
SQL> CREATE INDEX inx_v_sale on v_sale(month);
CREATE INDEX inx_v_sale on v_sale(month)
ORA-01702: a view is not appropriate here
事实证明:不行。
Sorry, the comment form is closed at this time.
No comments yet.