oracle单语义,oracle语义模式

在进行数据库查询的时候,通过打开语义模式可以在查询的时候忽略大小写。

写道

SQL> select * from ajlx where id = 1;

ID MC

---------- ----------------------------------------

1 aaBB

通常使用like 'AABB' 时,会查不到任何数据。然后可以通过更改会话:

写道

SQL> ALTER SESSION SET NLS_COMP=LINGUISTIC;

会话已更改。

SQL> ALTER SESSION SET NLS_SORT=BINARY_CI;

会话已更改。

这时执行like查询语句时,系统就会自动忽略掉大小写关系,将以上语句查询出来。

写道

SQL> select * from ajlx where id = 1 and mc like 'AABB';

ID MC

---------- ----------------------------------------

1 aaBB

以上是在SQLPlus中的操作步骤,在一个会话中修改nls_comp和nls_sort来更改数据库查询和排序的方式。

如果是在JDBC中可以直接使用发送SQL语句来进行语义环境设置。

写道

session.createSQLQuery("ALTER SESSION SET NLS_COMP=LINGUISTIC")

.executeUpdate();

session.createSQLQuery("ALTER SESSION SET NLS_SORT=BINARY_CI")

.executeUpdate();

但是设置 NLS_COMP=LINGUISTIC有着明显的性能问题,系统总是会进行全表扫描。

写道

LINGUISTIC

Comparisons for all SQL operations in the WHERE clause and in PL/SQL blocks should use the linguistic sort specified in the NLS_SORT parameter. To improve the performance, you can also define a linguistic index on the column for which you want linguistic comparisons.

在oracle官方文档中说,当NLS_COMP被设置为LINGUISTIC时,会引起很严重的性能消耗,建议在该列上建立语义索引。

建立linguistic index:

Using Linguistic Indexes

Linguistic sorting is language-specific and requires more data processing than binary sorting. Using a binary sort for ASCII is accurate and fast because the binary codes for ASCII characters reflect their linguistic order. When data in multiple languages is stored in the database, you may want applications to sort the data returned from a SELECT...ORDER BY statement according to different sort sequences depending on the language. You can accomplish this without sacrificing performance by using linguistic indexes. Although a linguistic index for a column slows down inserts and updates, it greatly improves the performance of linguistic sorting with the ORDER BY clause.

You can create a function-based index that uses languages other than English. The index does not change the linguistic sort order determined by NLS_SORT . The index simply improves the performance. The following statement creates an index based on a German sort:

CREATE TABLE my_table(name VARCHAR(20) NOT NULL);

CREATE INDEX nls_index ON my_table (NLSSORT(name, 'NLS_SORT = German'));

/*The NOT NULL in the CREATE TABLE statement ensures that the index is used*/

After the index has been created, enter a SELECT statement similar to the following:

SELECT * FROM my_table ORDER BY name;

It returns the result much faster than the same SELECT statement without an index.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
目录 第1 章 Designer 简介 1.1 概述 ...................................................... 8 1.2 Designer 和 Universe 基本原理 ............................. 8 1.3 如何使用 Designer 来创建 Universe? ...................... 12 1.4 谁是 Universe 的设计员? ................................. 15 1.5 Universe 开发过程简介 .................................... 16 1.6 Designer 示例材料 ........................................ 19 第2 章 执行基本操作 2.1 概述 ..................................................... 21 2.2 启动 Designer ............................................ 21 2.3 导入 Universe ............................................ 25 2.4 打开 Universe ............................................ 27 2.5 导出 Universe ............................................ 28 2.6 保存 Universe ............................................ 30 2.7 关闭 Universe ............................................ 32 2.8 创建 Universe ............................................ 32 2.9 设置 Universe 参数 ....................................... 35 2.10使用 Designer 用户界面 ................................... 67 2.11使用 “查找并替换” .......................................71 2.12组织表显示 ............................................... 74 2.13选择模式显示选项 ......................................... 79 2.14打印 Universe ............................................ 86 第 3 章 创建包含表和联接的架构 3.1 概述 ..................................................... 89 3.2 什么是模式? ............................................. 89 3.3 插入表 ................................................... 91 3.4 使用派生表 ............................................... 95 3.5 定义联接 ................................................. 99 3.6 定义特定的联接类型 ...................................... 116 3.7 使用基数 ................................................ 132 3.8 检查 Universe ........................................... 140 第 4 章 解决架构中的联接问题 4.1 概述 .................................................... 145 4.2 什么是联接路径问题? .................................... 145 4.3 定义别名 ................................................ 147 4.4 定义上下文 .............................................. 152 4.5 解决环路 ................................................ 162 4.6 解决断层陷阱 ............................................ 188 4.7 解决扇形陷阱 ............................................ 193 4.8 以图形方式检测联接问题 .................................. 199 4.9 检查 Universe ........................................... 202 第 5 章 构建 Universe 5.1 概述 .................................................... 207 5.2 Universe 构建简介 ....................................... 207 5.3 使用 “Universe”窗格 ................................... 210 5.4 有关类、对象和条件的基本操作 ............................211 5.5 定义类 ..................................................212 5.6 定义对象 ................................................215 5.7 定义层次结构 ............................................247 5.8 使用层次结构的级联值列表 ................................251 5.9 使用值列表 ..............................................254 5.10自动创建基本的 Universe .................................269 5.11测试 Universe ...........................................276 第6 章 生成 OLAP Universe 6.1 概述 ....................................................278 6.2 依据 OLAP 多维数据集源生成 OLAP Universe ................279 6.3 创建 OLAP 连接 ..........................................280 6.4 创建 OLAP Universe ......................................282 6.5 保存并导出 OLAP Universe ................................285 6.6 更新 OLAP Universe ......................................286 6.7 OLAP 至 Universe 映射 ...................................286 第7 章 依据元数据源创建 Universe 7.1 概述 ....................................................295 7.2 依据元数据源生成 Universe ...............................295 7.3 选择元数据源 ............................................296 7.4 XML 元数据源 ............................................298 7.5 Oracle 分析工作区 .......................................308 第8 章 创建 Universe 以用作 Metric 8.1 概述 ....................................................321 8.2 使用 Universe 来构建 Metric .............................321 8.3 企业 Metric ............................................. 324 8.4 Process Analysis 统计图的 Universe 配置 ................. 327 8.5 为基于集合的 Metric 设计 Universe ....................... 330 第 9 章 优化 Universe 9.1 概述 .................................................... 333 9.2 使用聚合表 .............................................. 333 9.3 使用 @ 函数 ............................................. 346 9.4 使用外部策略定制 Universe 创建 .......................... 354 9.5 使用分析函数 ............................................ 367 第 10 章 管理 Universe 10.1概述 .................................................... 379 10.2部署 Universe ........................................... 379 10.3针对 Universe 设置访问限制 .............................. 380 10.4与多个设计员一起工作 .................................... 389 10.5链接 Universe ........................................... 390 10.6在一个 Universe 中包含另一个 Universe ................... 399 10.7管理用户和登录 .......................................... 400 10.8优化 Universe ........................................... 402 附录 A 使用示例资料 A.1 概述 .................................................... 405 A.2 Club 数据库 ............................................. 405 附录 B Business Objects 信息资源 B.1 文档和信息服务 .......................................... 411 B.2 文档 .................................................... 411 B.3 客户支持、咨询和培训 ....................................412 B.4 实用地址一览 ............................................413 附录C 版本发布后的补遗 C.1 概述 ....................................................414 C.2 DBUser/DBPass ...........................................414 索引.............................................415

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值