Oracle中的单引号与双引号
使用Oracle的时候,发现单、双引号的使用是有区别的,就上网查了一些资料,自己做了一些总结:双引号:建立对象的时候,对象名、
那天使用Oracle的时候,发现单、双引号的使用是有区别的,就上网查了一些资料,自己做了一些总结:
双引号:建立对象的时候,对象名、字段名加双引号,则表示Oracle将严格区分大小写,否则Oracl都默认大写。
单引号:这个加了单引号的字段是一个字类似字符串,并不区分大小写。
单引号用于标识字符与数字的区别,当指定字符串文本时,必须用单引号将字符串文本引住。
Oracle10g之前,假如字符串文本里含有单引号,那么必须运用两个单引号示意。例如:I'm a String! 字符串文本则为:string_var:='I''m a String!'
在oracle10g中可以运用其它分隔符(,[],{}等),留心,运用这些分隔符时,,不仅要在分隔符前后加单引号,还要带有前缀q.例:string_var:=q'[I''m a String!]';
例如
select * from table_name where id=1;这种代表查询的是数字
select * from table_name where;这种代表查询的是字符
假如你有个表的字段叫sysdate,因为sysdate属于oracle中的特有字符,当你要查询这个字段的时候,需要这样写
select "sysdate" from table_name;
如果你这样写select 'sysdate' from table_name,那么你查出来的就是字符串,结果是sysdate
单引号在 Oracle 中有三种身份:
1. 用来引用一个字符串常量,也就是界定一个字符串的开始和结束 2. 转义符,对紧随其后出现的字符(单引号)进行转义 3. 表示它本身,也就是它作为一个字符串的一部分而出现在一个字符串常量中总结经验: 1. 出现在表达式开头和结尾的这两个单引号的含义肯定是表示引用一个字符串,界定字符串的开始和结束 2. 如果单引号出现在表达式中间(即非表达式开头和结尾的单引号),且多个单引号之间没有任何其他字符,那么当我们从左向右分析时,第一对单引号中的第一个是转义符,它对紧随其后的第二个单引号进行转义,以使第二个单引号作为一个字符出现在一个字符串常量中。第二对,第三对,以此类推.......示例一:
select 'exit''''' from dual
表达式 'exit''''' 中第一个和最后一个单引号表示引用一个字符串常量,表达式的剩余部分从左往右分析。剩余部分中,遇到的第一个单引号后面紧随一个单引号,我们将其作为一对,根据示例一,这一对的解析结果为一个单引号字符本身;然后继续向右走,又遇到一对紧挨着的单引号,同理,他们的解析结果也是一个单引号字符本身。分析得出这里的字符串常量包含exit和两个单引号字符,即结果为: result exit''

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

InnoDB's full-text search capabilities are very powerful, which can significantly improve database query efficiency and ability to process large amounts of text data. 1) InnoDB implements full-text search through inverted indexing, supporting basic and advanced search queries. 2) Use MATCH and AGAINST keywords to search, support Boolean mode and phrase search. 3) Optimization methods include using word segmentation technology, periodic rebuilding of indexes and adjusting cache size to improve performance and accuracy.

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

The difference between clustered index and non-clustered index is: 1. Clustered index stores data rows in the index structure, which is suitable for querying by primary key and range. 2. The non-clustered index stores index key values and pointers to data rows, and is suitable for non-primary key column queries.

The article discusses dropping tables in MySQL using the DROP TABLE statement, emphasizing precautions and risks. It highlights that the action is irreversible without backups, detailing recovery methods and potential production environment hazards.

The article discusses creating indexes on JSON columns in various databases like PostgreSQL, MySQL, and MongoDB to enhance query performance. It explains the syntax and benefits of indexing specific JSON paths, and lists supported database systems.
