SQL statement correct, but error java.sql.SQLSyntaxErrorException ORA-00907: missing closing parenthesis

Source: Internet
Author: User

The SQL statements are as follows, with the parameters in Oracle executing normally, and the error in the Java program Java.sql.SQLSyntaxErrorException ORA-00907: Missing closing parenthesis


Select Re.*,

Tbp.taskid,

Tbp.processtype,

Tbp.processstatus,

Tbp.timelimit,

Tbp.createtime Posttime,

Tbp.procontent dealcontent

From BIZ_T_TASKTROUBLEPROCESSTBP

Right Join (select t.*

Frombiz_t_tasktrouble T

where 1 = 1

and T.status In:status

and t.protype in:inprotypes) re

On tbp.ttrid = Re.ttrid





Key place marked red, parameters passed Sp.put ("Inprotypes", Arrays.aslist (protypes));


After the parameters are taken, and t.protype in (' 1 ', ' 2 ', ' 3 ', ' 4 ', ' 5 ', ' 6 '), since the parameter originally has a closing parenthesis on the right side,

So when the parameter is converted it is treated as a closing parenthesis by default, so when Java executes SQL is generated, there is actually a missing parenthesis.


Improved notation, and and T.protype in (: inprotypes)) re
Run correctly, by

SQL statement correct, but error java.sql.SQLSyntaxErrorException ORA-00907: missing closing parenthesis

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.