"Oracle.DataAccess.Client.OracleException ORA-00933" error occurred while inserting records into Oracle

Source: Internet
Author: User

Pop-up box for error messages

The contents of the exception:

"Oracle.DataAccess.Client.OracleException" type of unhandled exception occurs in DBFSR.dll with additional information: External component has thrown an exception.

Catch Exception information:

Oracle.DataAccess.Client.OracleException ora-00933:sql command did not end correctly at Oracle.DataAccess.Client.OracleException.HandleErrorHelper (Int32 Errcode, OracleConnection Conn, IntPtr Opserrctx, oposqlvalctx*

Solution :

My Oracle statement is

StringBuilder strSQL = new StringBuilder ();
Strsql.append ("INSERT INTO hp_table (");
Strsql.append ("ts_id,date_solar,date_lunar,hp_fid,hour_00," +
"Hour_01,hour_02,hour_03,hour_04,hour_05,hour_06,hour_07,hour_08,hour_09,hour_10," +
"Hour_11,hour_12,hour_13,hour_14,hour_15,hour_16,hour_17,hour_18,hour_19,hour_20," +
"Hour_21,hour_22,hour_23,\" sum\ ",\ "Avg\", g1_t,g1_l,g2_t,g2_l,d1_t,d1_l,d2_t,d2_l,update_time,details) ");
Strsql.append ("values");
Strsql.append (": ts_id,:D ate_solar,:D ate_lunar,:hp_fid,:hour_00," +
": hour_01,:hour_02,:hour_03,:hour_04,:hour_05,:hour_06,:hour_07,:hour_08,:hour_09,:hour_10," +
": hour_11,:hour_12,:hour_13,:hour_14,:hour_15,:hour_16,:hour_17,:hour_18,:hour_19,:hour_20," +
": Hour_21,:hour_22,:hour_23,:\" sum\ ",: AVG,: g1_t,:g1_l,:g2_t,:g2_l,:D 1_t,:D 1_l,:D 2_t,:D 2_l,:update_time,:D etails) ");
After checking, the discovery is a keyword conflict, in the above "AVG" keyword and system function conflict, only the above AVG quoted is not enough, but also the following AVG parameter name in quotation marks.

PS, in fact, after the author test, the parameter name of sum can be unquoted.

...

": Hour_21,:hour_22,:hour_23,:\" sum\ ",: \" Avg\ ",: g1_t,:g1_l,:g2_t,:g2_l,:D 1_t,:D 1_l,:D 2_t,:D 2_l,:update_time ,:D etails) ");

...

This solves the problem. Perform a normal insert operation.

Experience:

(1) For longer SQL statements, it is best to paste them into word for segmentation recognition, otherwise it is difficult to guarantee the correct.

(2) General writing SQL statements can now be tested correctly, as in PL/SQL.

(3) Usually more SQL statements, including advanced operating syntax, such as the establishment of rules, things, cross-Library data transfer, trigger, data table design, real-time update data trigger and operation. And typical instant messaging, concurrent operations, massive queries, indexing, backup and recovery, security and more.

"Oracle.DataAccess.Client.OracleException ORA-00933" error occurred while inserting records into Oracle

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.