When the angel used Oracle, he found that the use of single and double quotation marks was different. Then he checked some information online and made some summary:
Double quotation marks: when an object is created, the object name and field name are added with double quotation marks, which means that Oracle will be case-sensitive. Otherwise, both of them are capitalized by default.
Single quotes: this field with single quotes is a string similar to a character and is case-insensitive.
Single quotation marks are used to identify the differences between characters and numbers. When a string text is specified, single quotation marks must be used to enclose the string text.
Before Oracle10g, if the string text contains single quotes, you must use two single quotes. For example: I'm a String! The String text is: string_var: = 'I'm a String! '
Other delimiters (<>, [], {}, etc.) can be used in oracle10g. Note that when using these delimiters, you must not only add single quotation marks before and after the delimiters, but also contain the prefix q. example: string_var: = Q' [I'm a String!] ';
For example
Select * from table_name where id = 1; this indicates that the queried number is
Select * from table_name where id = '1 ';
Assume that you have a table field called sysdate, because sysdate is a special character in oracle, when you want to query this field, you need to write it like this
Select "sysdate" from table_name;
If you write select 'sysdate' from table_name in this way, the string is displayed and the result is sysdate.
Single quotes have three identities in Oracle:
1. it is used to reference A String constant, that is, to define the start and end of a string. 2. escape Character to escape the characters (single quotes) that follow it. indicates itself, that is, it appears in a String constant as a part of a string. Conclusion: 1. the meaning of the two single quotes that appear at the beginning and end of the expression must be to reference a string and define the start and end of the string. 2. if the single quotation marks appear in the middle of the expression (that is, the single quotation marks starting and ending with a non-expression), and there are no other characters between the multiple single quotation marks, when we analyze from left to right, the first character in the first pair of single quotes is an escape character. It escapes the second single quotes that follow it to make the second single quotes appear as a character in a String constant. The second, third, and so on ...... Example 1:
Select 'exit ''' from dual
The first and last single quotes in the expression 'exit ''' indicate that a String constant is referenced, and the rest of the expression is analyzed from left to right. In the remaining part, the first single quotation mark is followed by a single quotation mark. We use it as a pair. According to Example 1, the parsing result of this pair is a single quotation mark character. Then, we continue to go to the right, we also encounter a pair of single quotes that are next to each other. Similarly, their parsing results are also a single quotes character. The analysis results show that the String constant contains exit and two single quotation marks. The result is: result exit''