Special characters encountered during SQL Execution in Oracle &

Source: Internet
Author: User

During data correction today, I wrote a batch of simple update statements. The results showed a problem in sqlplus execution, prompting me to enter the value of the corresponding parameter?

The original SQL statement is: Update trans_record set Params = 'service = standard_bail & xxx = 112 'Where trans_record_id = '20140901 ';

After investigation, the problem lies in the character &, which is a character passed in by the control parameter;

There are several methods to solve the execution problem:

1. Execute in sqlplusSet define offDisable special characters. You can use show define to view the special characters;

2. Update trans_record set Params = 'service = standard_bail'| '&' |'Xxx = 100' where trans_record_id = '20140901 ';

3. Update trans_record set Params = 'service = standard_bail'| CHR (38) |'Xxx = 100' where trans_record_id = '20140901 ';

4. Update trans_record set Params = 'service = standard_bail/&Xxx = 112 'where trans_record_id = '201312 ';

The first method is recommended for the above four methods, which is simple and completely solves the special character problem (the premise is to see which special characters are closed in the end), because there are not only special characters, but also %;

PS: this type of problem only occurs in sqlplus. This problem does not occur during direct JDBC operations in our daily development;

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.