mysql这句话为什么老报错

select * from jrjf.t_base_ignoemp  where v_createorgid in (${jg}) ${if(xm="",""," and v_empname = '"+xm+"'")} ${if(dm="",""," and c_source_system = '"+dm+"'")} 

${if(gh="",""," and c_source_staffgh = '"+gh+"'")} ${if(zt="",""," and n_del = '"+zt+"'")} 

配置错误You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1

把v_createorgid in (${jg}) 改成v_createorgid=1 就没事

FineReport yzm203888 发布于 2023-5-9 10:53
1min目标场景问卷 立即参与
回答问题
悬赏:3 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共2回答
最佳回答
0
yzm203888Lv2见习互助
发布于2023-5-9 10:57

参数问题

最佳回答
0
l香菜lLv4见习互助
发布于2023-5-9 10:59

SELECT

FROM

jrjf.t_base_ignoemp 

WHERE

v_createorgid IN ( $ { jg } ) 

$ { IF ( xm = "", "", " and v_empname = '" + xm + "'" ) } 

$ { IF ( dm = "", "", " and c_source_system = '" + dm + "'" ) } 

$ { IF ( gh = "", "", " and c_source_staffgh = '" + gh + "'" ) } 

$ { IF ( zt = "", "", " and n_del = '" + zt + "'" ) }

问题: v_createorgid IN ( $ { jg } ) 这里时jg没值时in()就报错了   这里核验下jq参数传值是否有问题 或者当为空时 传个默认值

  • 1关注人数
  • 208浏览人数
  • 最后回答于:2023-5-9 10:59
    请选择关闭问题的原因
    确定 取消
    返回顶部