- 浏览: 1158907 次
- 性别:
- 来自: 北京
-
文章分类
- 全部博客 (411)
- Java Foundation (41)
- AI/机器学习/数据挖掘/模式识别/自然语言处理/信息检索 (2)
- 云计算/NoSQL/数据分析 (11)
- Linux (13)
- Open Source (12)
- J2EE (52)
- Data Structures (4)
- other (10)
- Dev Error (41)
- Ajax/JS/JSP/HTML5 (47)
- Oracle (68)
- FLEX (19)
- Tools (19)
- 设计模式 (4)
- Database (12)
- SQL Server (9)
- 例子程序 (4)
- mysql (2)
- Web Services (4)
- 面试 (8)
- 嵌入式/移动开发 (18)
- 软件工程/UML (15)
- C/C++ (7)
- 架构Architecture/分布式Distributed (1)
最新评论
-
a535114641:
LZ你好, 用了这个方法后子页面里的JS方法就全不能用了呀
页面局部刷新的两种方式:form+iframe 和 ajax -
di1984HIT:
学习了,真不错,做个记号啊
Machine Learning -
赵师傅临死前:
我一台老机器,myeclipse9 + FB3.5 可以正常使 ...
myeclipse 10 安装 flash builder 4.6 -
Wu_Jiang:
触发时间在将来的某个时间 但是第一次触发的时间超出了失效时间, ...
Based on configured schedule, the given trigger will never fire. -
cylove007:
找了好久,顶你
Editable Select 可编辑select
引用
Oracle allows the assignment of special escape characters to tell Oracle that the character is interpreted literally. Certain characters such as the underscore “_” are not interpreted literally because they have special meaning within Oracle.
In the example below, we want to find all Oracle parameter that relate to I/O, so we are tempted to use the filter LIKE “%_io_%’. Below we will select from the x$ksppi fixed table, filtering with the LIKE clause:
select ksppinm
from x$ksppi
where ksppinm like '%_io_%';
KSPPINM
--------------------------------
sessions
license_max_sessions
license_sessions_warning
_session_idle_bit_latches
_enable_NUMA_optimization
java_soft_sessionspace_limit
java_max_sessionspace_size
_trace_options
_io_slaves_disabled
dbwr_io_slaves
_lgwr_io_slaves
As you can see above, we did not get the answer we expected. The SQL displayed all values that contained “io”, and not just those with an underscore. To remedy this problem, Oracle SQL supports an ESCAPE clause to tell Oracle that the character is to be interpreted literally:
select ksppinm
from x$ksppi
where ksppinm like '%\_io\_%' ESCAPE '\';
KSPPINM
--------------------------------------
_io_slaves_disabled
dbwr_io_slaves
_lgwr_io_slaves
_arch_io_slaves
_backup_disk_io_slaves
backup_tape_io_slaves
_backup_io_pool_size
_db_file_direct_io_count
_log_io_size
fast_start_io_target
_hash_multiblock_io_count
_smm_auto_min_io_size
_smm_auto_max_io_size
_ldr_io_size
引用
Oracle databases reserve some special characters with specific meaning and purpose within Oracle environment. These reserved characters include _ (underscore) wild card character which used to match exactly one character, % (percentage) which used to match zero or more occurrences of any characters and ‘ (apostrophe or quotation mark) which used to mark the value supplied. These special characters will not be interpreted literally when building SQL query in Oracle, and may caused error in results returned especially when performing string search with LIKE keyword. To use these characters so that Oracle can interpret them literally as a part of string value instead of preset mean, escape character has to be assigned.
Oracle allows the assignment of special escape characters to the reserved characters in Oracle can be escaped to normal characters that is interpreted literally, by using ESCAPE keyword.
For example, to select the name of guests with _ (underscore) in it, use the following statement:
SELECT guest_name FROM guest_table WHERE name LIKE ‘%\_%’ ESCAPE ‘\’;
Without specifying the \ (backslash) as escape clause, the query will return all guest names, making the unwanted results problem.
The above syntax will not work on ‘ (quote). To escape this quotation mark and to display the quote literally in string, insert another quote (total 2 quotes) for every quote that want to be displayed. For example:
SELECT ‘This will display line with quote’’s word.’ FROM temp_table;
SELECT ‘This will display ””double quoted”” word.’ FROM temp_table;
will return the following respectively:
This will display line with quote’s word.
This will display ”double quoted” word.
发表评论
-
Oracle: minus | in | exists
2012-09-05 13:49 1515解释及例子: MINUS Query: http://www. ... -
一个奇怪的Oracle sql问题
2011-01-13 16:13 1391select A.M,B.N from Table1 A ... -
Oracle Analytic Functions:RANK, DENSE_RANK, FIRST and LAST;PARTITION BY
2010-12-13 17:02 1338Oracle/PLSQL: Rank Function: ht ... -
Oracle Analytic Functions:RANK, DENSE_RANK, FIRST and LAST
2010-12-13 17:02 1287Oracle/PLSQL: Rank Function: ht ... -
Oracle:Collections Records Type %TYPE %ROWTYPE
2010-11-09 22:27 1288PL/SQL Collections and Records: ... -
Oracle Cursor 游标
2010-11-09 20:44 3070Oracle中Cursor介绍: http://www.ite ... -
Oracle 锁机制
2010-09-19 20:12 3741Oracle多粒度封锁机制研究: http://www.itp ... -
Oracle Data Dictionary 数据字典
2010-09-19 16:44 1569Oracle数据字典查阅: http://download.o ... -
Oracle Sign Function
2010-09-17 14:52 1481Oracle/PLSQL: Sign Function: ht ... -
Oracle Built-In Functions: Next_Day and Last_Day
2010-09-16 17:09 1559next_day(date,char): 它用来返回从第一个 ... -
Oracle Procedure 存储过程
2010-09-16 08:36 1384Oracle/PLSQL: Creating Procedur ... -
Oracle Exception Handle 异常处理
2010-09-15 13:00 2121Handling PL/SQL Errors: http:// ... -
Oracle 性能工具 : Explain plan、Autotrace、Tkprof
2010-09-14 18:07 2274Oracle: 三个内置的性能工具包 Explain plan ... -
关于Oracle数据和对象的导入导出 [转]
2010-09-14 10:25 1297关于Oracle数据和对象的导入导出 [转]: http:// ... -
Oracle jobs(DBMS_JOB and DBMS_SCHEDULER)
2010-07-21 14:14 7873写PL/SQL procedure的时候,一定要写的够健壮、够 ... -
Oracle 各种注释
2010-07-20 14:19 3689为SQL语句添加注释: http://do ... -
Oracle 监听 本地Net服务名 配置
2010-07-20 10:32 1343Oracle数据库配置: http://shupili1410 ... -
[Oracle]Difference between a database and an instance(数据库 实例 区别)
2010-07-20 09:31 1518Difference between a database a ... -
Oracle Bulk Collect
2010-07-16 10:03 1394On BULK COLLECT: http://www.ora ... -
Oracle/PLSQL: FOR Loop 循环语句
2010-07-15 16:43 9388Oracle/PLSQL: FOR Loop: http:// ...
相关推荐
11. 字符串 SQL 正则表达式匹配函数:`substring(string from pattern for escape)` 该函数用于根据 SQL 正则表达式截取字符串中的子串。例如,`substring('Thomas' from '%#"o_a#"_' for '#')`将返回`'omat'`。 ...
QuoteNames option in TUniLoader to escape field names is added Bug with mapping a TEXT field to ftWideMemo in Delphi is fixed Bug with SQL statements containing a CONTAINS predicate in the WHERE ...
QuoteNames option in TUniLoader to escape field names is added Bug with mapping a TEXT field to ftWideMemo in Delphi is fixed Bug with SQL statements containing a CONTAINS predicate in the WHERE ...
v8.0.1 RAD Studio 10.3 Rio is supported Support of UPPER and LOWER ...Oracle 12 is fixed Bug with using the IFILE option in TNSNAMES.ORA is fixed SQLServer data provider QuoteNames option in TUniLoader ...
v8.0.1 RAD Studio 10.2 Tokyo is supported Support of UPPER and LOWER...Oracle 12 is fixed Bug with using the IFILE option in TNSNAMES.ORA is fixed SQLServer data provider QuoteNames option in TUniLoader ...