search
HomeDatabaseMysql TutorialOracle中的单引号与双引号

使用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''

linux

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
How do you alter a table in MySQL using the ALTER TABLE statement?How do you alter a table in MySQL using the ALTER TABLE statement?Mar 19, 2025 pm 03:51 PM

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

How do I configure SSL/TLS encryption for MySQL connections?How do I configure SSL/TLS encryption for MySQL connections?Mar 18, 2025 pm 12:01 PM

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]

How do you handle large datasets in MySQL?How do you handle large datasets in MySQL?Mar 21, 2025 pm 12:15 PM

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

What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?Mar 21, 2025 pm 06:28 PM

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

How do you drop a table in MySQL using the DROP TABLE statement?How do you drop a table in MySQL using the DROP TABLE statement?Mar 19, 2025 pm 03:52 PM

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.

How do you create indexes on JSON columns?How do you create indexes on JSON columns?Mar 21, 2025 pm 12:13 PM

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.

How do you represent relationships using foreign keys?How do you represent relationships using foreign keys?Mar 19, 2025 pm 03:48 PM

Article discusses using foreign keys to represent relationships in databases, focusing on best practices, data integrity, and common pitfalls to avoid.

How do I secure MySQL against common vulnerabilities (SQL injection, brute-force attacks)?How do I secure MySQL against common vulnerabilities (SQL injection, brute-force attacks)?Mar 18, 2025 pm 12:00 PM

Article discusses securing MySQL against SQL injection and brute-force attacks using prepared statements, input validation, and strong password policies.(159 characters)

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.