DB2 inserting single quotation marks with double quotes

Source: Internet
Author: User
Tags db2 db2 insert
1. If it is single quotes, the following error appears:

DB2 INSERT into sales (region) values (')

db21034e This command is treated as SQL

Statement because it is not a valid command line Processor command. During SQL processing, it returns:

SQL0010N string constants that start with "'" do not have string end delimiters. sqlstate=42603

2. If it is a double quote, run the following command and then look at it with the Select command and find that the double quote is not displayed

DB2 INSERT into sales (region) VALUES (' ")

How do I handle this?

Answer: For questions that need to be inserted into the quote character, you can do so by using the following method:

1. If you need to enter single quotes, you can enter two single quotes consecutively, inserting a single quotation mark into the table, and the first single quotation mark will be used as an escape character, such as:

DB2 INSERT into sales (region) VALUES (' ")

Inserts a single quote into the field region,

DB2 INSERT into sales (region) VALUES (' char ' char ')

The char ' char is inserted into the field region;

2. If you need to insert double quotes, you need to precede the double quotes with \ As an escape character, as

DB2 INSERT into sales (region) VALUES (' tt\ ' DD ')

The TT "DD" is inserted into the field region.

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.