您的位置:首页 > 博客中心 > 数据库 >

sql语句正确,但是报错java.sql.SQLSyntaxErrorException ORA-00907: 缺失右括号

时间:2022-03-14 03:05

sql语句如下,在oracle中带入参数能正常执行,在java程序中则报错java.sql.SQLSyntaxErrorException ORA-00907: 缺失右括号


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





关键地方标红,参数通过sp.put("InProTypes", Arrays.asList(proTypes));传入


带入参数后为and t.proType in (‘1‘, ‘2‘, ‘3‘, ‘4‘, ‘5‘, ‘6‘),因为参数原本右边自带一个右括号,

所以参数转换时就默认把它当做自己的右括号,因此生成java执行sql时,实际就少了一个括号。


改进写法,and and t.proType in (:InProTypes) ) re
正确运行,通过

热门排行

今日推荐

热门手游