V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
sunziren
V2EX  ›  程序员

救人一命胜造七级浮屠,这个哥哥们救我-sql`mybatis`druid

  •  
  •   sunziren · 2020-01-15 17:09:46 +08:00 · 561 次点击
    这是一个创建于 1577 天前的主题,其中的信息可能已经有所发展或是发生改变。

    问题:同一个 sql,放到 plsql 执行没问题,放到项目中用 mybstis 就出不来。 sql: select * from (select xn,qxdm,nj,xk,gxsj,nvl(cbbb,'null')cbbb from jczd_gjjcxy) t pivot( max(t.cbbb) for xk in ( '道德与法制' as cnt1, '语文' as cnt2, '数学' as cnt3, '音乐' as cnt4, '美术' as cnt5, '科学' as cnt6, '英语' as cnt7, '书法' as cnt8, '信息技术' as cnt9 ) ) where 1=1 报错内容: 1.Cause: java.sql.SQLException: sql injection violation, syntax error: syntax error, expect RPAREN, actual FOR pos 116, line 2, column 25, token FOR :(上面的 sql ) 2.uncategorized SQLException; SQL state [null]; error code [0]; sql injection violation, syntax error: syntax error, expect RPAREN, actual FOR pos 116, line 2, column 25, token FOR:(上面的 sql ) 3.com.alibaba.druid.sql.parser.ParserException: syntax error, expect RPAREN, actual FOR pos 116, line 2, column 25, token FOR 补充: 1.正常 sql 能在项目用,就这个不能再项目中用,但这个 sql 在 plsql 是完全能执行的。 2.这个 sql 用来行转列。 3.卡在这一天了,救命。 4.帮得上的回复必感谢

    6 条回复    2020-10-29 09:55:31 +08:00
    dustinyjj
        1
    dustinyjj  
       2020-10-29 09:22:01 +08:00
    老哥,这个问题解决了吗
    sunziren
        2
    sunziren  
    OP
       2020-10-29 09:23:26 +08:00
    @dustinyjj 好家伙,你可真能翻。解决了
    dustinyjj
        3
    dustinyjj  
       2020-10-29 09:39:48 +08:00
    咋解决,能说下吗?我也遇到了这个问题,搞了好久才看到你这个帖子
    sunziren
        4
    sunziren  
    OP
       2020-10-29 09:41:25 +08:00
    @dustinyjj mybatis 依赖的版本问题,换个更高的
    sunziren
        5
    sunziren  
    OP
       2020-10-29 09:42:11 +08:00
    dustinyjj
        6
    dustinyjj  
       2020-10-29 09:55:31 +08:00
    可以了,感谢老哥!!!
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5607 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 06:52 · PVG 14:52 · LAX 23:52 · JFK 02:52
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.