全文索引的语法和Oracle的相似,但是有不少的区别,比如全文索引比较要先填充才能使用,比如CONTAINS操作返回的是布尔类型而不是数值。由于这部分包含的内容比较多,这里就不深入了,不过达梦显然是支持全文索引功能的,而且也是支持中文切词的。
达梦数据库支持视图对象:
SQL>CREATE VIEW V_TEST
2 AS SELECT * FROM T;
CREATE VIEW V_TEST
AS SELECT * FROM T;
time used: 32.179(ms) clock tick:53413690.
SQL>SELECT * FROM V_TEST;
SELECT * FROM V_TEST;
id name create_date
1 1 A NULL
2 2 B 2010-04-07
3 3 ABC NULL
3 rows got
time used: 0.524(ms) clock tick:860730.
SQL>UPDATE V_TEST
2 SET NAME = LOWER(NAME);
UPDATE V_TEST
SET NAME = LOWER(NAME);
3 rows affected
time used: 28.230(ms) clock tick:47182590.
SQL>SELECT * FROM V_TEST;
SELECT * FROM V_TEST;
id name create_date
1 1 a NULL
2 2 b 2010-04-07
3 3 abc NULL
3 rows got
time used: 0.292(ms) clock tick:473380.
2 AS SELECT * FROM T;
CREATE VIEW V_TEST
AS SELECT * FROM T;
time used: 32.179(ms) clock tick:53413690.
SQL>SELECT * FROM V_TEST;
SELECT * FROM V_TEST;
id name create_date
1 1 A NULL
2 2 B 2010-04-07
3 3 ABC NULL
3 rows got
time used: 0.524(ms) clock tick:860730.
SQL>UPDATE V_TEST
2 SET NAME = LOWER(NAME);
UPDATE V_TEST
SET NAME = LOWER(NAME);
3 rows affected
time used: 28.230(ms) clock tick:47182590.
SQL>SELECT * FROM V_TEST;
SELECT * FROM V_TEST;
id name create_date
1 1 a NULL
2 2 b 2010-04-07
3 3 abc NULL
3 rows got
time used: 0.292(ms) clock tick:473380.
而且视图也是可以更新的。
下面看看同义词对象:
SQL>CREATE SYNONYM S_T FOR T;
CREATE SYNONYM S_T FOR T;
time used: 38.520(ms) clock tick:64245130.
SQL>SELECT * FROM S_T;
SELECT * FROM S_T;
id name create_date
1 1 a NULL
2 2 b 2010-04-07
3 3 abc NULL
3 rows got
time used: 0.528(ms) clock tick:865700.
SQL>CREATE PUBLIC SYNONYM S_1 FOR T;
CREATE PUBLIC SYNONYM S_1 FOR T;
time used: 31.936(ms) clock tick:53378050.
SQL>CREATE SYNONYM S_TEST FOR F_TAX;
CREATE SYNONYM S_TEST FOR F_TAX;
time used: 11.845(ms) clock tick:19788480.
SQL>SELECT S_TEST(5000) FROM T;
SELECT S_TEST(5000) FROM T;
1 325
2 325
3 325
3 rows got
time used: 0.495(ms) clock tick:815300.
CREATE SYNONYM S_T FOR T;
time used: 38.520(ms) clock tick:64245130.
SQL>SELECT * FROM S_T;
SELECT * FROM S_T;
id name create_date
1 1 a NULL
2 2 b 2010-04-07
3 3 abc NULL
3 rows got
time used: 0.528(ms) clock tick:865700.
SQL>CREATE PUBLIC SYNONYM S_1 FOR T;
CREATE PUBLIC SYNONYM S_1 FOR T;
time used: 31.936(ms) clock tick:53378050.
SQL>CREATE SYNONYM S_TEST FOR F_TAX;
CREATE SYNONYM S_TEST FOR F_TAX;
time used: 11.845(ms) clock tick:19788480.
SQL>SELECT S_TEST(5000) FROM T;
SELECT S_TEST(5000) FROM T;
1 325
2 325
3 325
3 rows got
time used: 0.495(ms) clock tick:815300.
可以创建普通同义词、PUBLIC同义词。可以创建指向表的同义词,也可以创建函数的同义词。这部分和Oracle中没有什么区别。
看看序列部分:
SQL>CREATE SEQUENCE S_1
2 INCREMENT BY 3
3 START WITH 5;
CREATE SEQUENCE S_1
INCREMENT BY 3
START WITH 5;
time used: 63.185(ms) clock tick:105098660.
SQL>SELECT S_1.NEXTVAL FROM T;
SELECT S_1.NEXTVAL FROM T;
NEXTVAL
1 5
2 8
3 11
3 rows got
time used: 0.947(ms) clock tick:1567590.
2 INCREMENT BY 3
3 START WITH 5;
CREATE SEQUENCE S_1
INCREMENT BY 3
START WITH 5;
time used: 63.185(ms) clock tick:105098660.
SQL>SELECT S_1.NEXTVAL FROM T;
SELECT S_1.NEXTVAL FROM T;
NEXTVAL
1 5
2 8
3 11
3 rows got
time used: 0.947(ms) clock tick:1567590.
序列也与Oracle提供的很相似,前面提到了,达梦实现了自增列,而现在又实现了类似功能的序列,主要应该是出于兼容性的考虑。
在前面已经提到了,达梦数据库是支持过程、函数、包和触发器的,但是达梦数据库不支持对象。
达梦还支持快照。不过这个SNAPSHOT和Oracle中的SNAPSHOT也就是物化视图大相径庭,达梦中的SNAPSHOT是数据库的快照,创建的实际上就是指定数据库在创建时间点的只读镜像,这实际上已经不是对象的概念了,这里就不再描述了。
总的来说,Oracle绝大部分的对象在达梦数据库中都是支持的,而且大部分对象的用法和功能都没有发生变化,这使得迁移在对象层面上变得可行。