Oracle special character escapes:& and & #39;

Source: Internet
Author: User

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;

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.