-
-
Oracle special character escapes:& and & #39;
-
-
-
-
when we execute the SQL Show all command under Sql*plus, we can find a parameter: Define & (Hex 26), as shown below concat. (hex 2e) copycommit 0 Copytypecheck on define & (hex) describe DEPTH 1 linenum OFF INDENT offecho OFF1, "&" escapes this is the setting in Oracle to identify the custom variable, and now we close it under Sql*plus: SQL set define off; Then execute the import script again, ok! Problem is done. Note: If you are executing in toad, it is recommended that the first line of the script to be imported, plus the previous one, be closed define, otherwise you will get an error when you import a second script that contains special characters. If you are executing in sql*plus, you only need to set the define OFF once, and you can import it continuously later. Until you reset define on. • Method Two: Replace ' & ' with Chr (38) In SQL statement, because CHR (38) is ' & ' ASCII code SQL Select ' Tom ' | | Chr (38) | | ' Jerry ' from dual; method Three: Splitting the original string SQL Select ' Tom ' | | ' & ' | | ' Jerry ' from dual; As we can see, the method is the simplest and most efficient. Method Two because there is a procedure to call the function, so the performance is slightly worse. Method three needs two times the connection string, the efficiency is the worst! 2, "'" Escape • Method One: Use the escape character SQL Select ' Test ' | | ' from dual; The third ' is our real content. Method Two: The same is the use of escape characters, but the way is different just SQL Select ' test ' from dual; Note: Here's the second, third ' is the escape character and the real content that we mentioned in method one above
Oracle special character escapes:& and & #39;