Processing of single quotes and String concatenation during oracle Storage

Source: Internet
Author: User

Processing of single quotes and String concatenation during oracle Storage
In ORACLE, single quotes have two functions: one is that strings are referenced by single quotes, and the other is escape. The use of single quotes is proximity matching, that is, proximity principle. It is not easy to understand when a single quotation mark acts as an escape character. 1. It is regarded as an escape character starting from the second single quotation mark. If the second single quotation mark is followed by a single quotation mark (even if there is only one ). Select ''' from dual ---- output: 'explanation: the second single quotation mark is used as an escape character, and the third single quotation mark is escaped. It is better to understand the SQL statement as follows: select ''' from dual ---- output: '2. connector '|' leads to a new escape: Connection Symbol '|' there is no relationship between the single quotation marks on the left and right, unless '|' is a part of a string (which is common in dynamic SQL ). Select 'name' | ''' from dual ---- output: name' understanding: | The following string is used as a string, that is, the front and back are ', the middle is an intensive single quotation mark '', so the first escape function is select 'name''' from dual ---- output: name: the first and last single quotes are used as string references, and the four single quotes are escaped in two. Here are a few simple examples: a single quotation mark is the most normal situation, for example, 'asdfas ', which represents a string with the displayed content asdfas and two single quotation marks, A pair is usually enclosed in a single quotation mark, indicating a single quotation mark within a single quotation mark, for example, 'sdfs' '000000' 'dfsdf ', this type of string is displayed in three or four single quotes of sdfs '000000' dfsdf, which is developed on one or two occasions, for example, 'asd ''' | input value | '''. The displayed content is asd 'input value '. (Separate one pair of two single quotes, one part before | and the other part after |) (separate the last four single quotes, and the other two are a pair -- represents a single quotation mark within a pair of single quotes, the outer two are a pair-representing a pair of single quotes)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.