Question & Answer
Question
I typed in the logical not sign as part of the not equal operator in my SQL statement. When I look at the statement in the catalog, I see that the logical not sign was changed to the circumflex accent. Why was this character changed?
Answer
You can use any of the following symbols to code a logical not sign:
The Db2 precompiler changes the logical not sign to the circumflex accent because the logical not symbol is a 2-byte character (X'C2AC') in Unicode, and the circumflex accent is a single byte character (X'5E') in Unicode. Consequently, the Db2 precompiler uses the single byte character because it is more convenient and preserves the storage length of of the statement.
Also note:
The Db2 SQL Reference discourages the use of the logical not sign in SQL statements because there are so many different codepoints for it. Instead, it recommends substituting logically equivalent operators. For example, use:
- Circumflex accent, or caret (^)
- Not sign (¬)
- Exclamation mark (!)
The Db2 precompiler changes the logical not sign to the circumflex accent because the logical not symbol is a 2-byte character (X'C2AC') in Unicode, and the circumflex accent is a single byte character (X'5E') in Unicode. Consequently, the Db2 precompiler uses the single byte character because it is more convenient and preserves the storage length of of the statement.
Also note:
The Db2 SQL Reference discourages the use of the logical not sign in SQL statements because there are so many different codepoints for it. Instead, it recommends substituting logically equivalent operators. For example, use:
- '<>' (less than or greater than) instead of '¬=' (not equal)
- '<=' (less than or equal to) instead of '¬>' (not greater than)
- '>=' (greater than or equal to) instead of '¬>' (not less than)
Related Information
[{"Product":{"code":"SSEPEK","label":"Db2 for z\/OS"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Unicode","Platform":[{"code":"PF035","label":"z\/OS"}],"Version":"10.0;11.0;12.0","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]
Was this topic helpful?
Document Information
Modified date:
20 June 2019
UID
swg21306736