It's all a semicolon (ORA-00911: Invalid character)

Source: Internet
Author: User
Today, I encountered a problem when writing SQL statements to query ORACLE data. The SQL statements written in the general SQL query analyzer (running everything normally) are thrown to the SQL statements written in C #. Program. Error CodeAs follows:

System. Data. oledb. oledbexception: one or more errors occurred during processing of command.
ORA-00911: Invalid character...

After checking for half a day, I did not find any cause of SQL errors (I suspected it was a problem with character transcoding, but I finally got rid of it). Finally, I found the answer online, it turns out "it's a semicolon "!

I generally like to add ":" at the end of each statement when writing SQL. I think this is also the habit of programmers who generally write SQL. Because many SQL queries and analysis at the time will regard this semicolon as the end of a statement. However, in actual execution, the semicolon cannot be thrown into the Oracle parser, because the Oracle syntax parser is very strict and the above error will be reported, the solution is also simple. Remove the semicolon.

The above problems apply to any Oracle Data Queries written in a program, and sometimes seem to get used to killing people.

Note:
I use the OCI interface in C language to call SQL statements. A semicolon is added at the end of the SQL statement.
Error code:911
Error description:ORA-00911: Invalid character.

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.