V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
sunziren
V2EX  ›  程序员

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

  •  
  •   sunziren · Jan 15, 2020 · 875 views
    This topic created in 2296 days ago, the information mentioned may be changed or developed.

    问题:同一个 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 replies    2020-10-29 09:55:31 +08:00
    dustinyjj
        1
    dustinyjj  
       Oct 29, 2020
    老哥,这个问题解决了吗
    sunziren
        2
    sunziren  
    OP
       Oct 29, 2020
    @dustinyjj 好家伙,你可真能翻。解决了
    dustinyjj
        3
    dustinyjj  
       Oct 29, 2020
    咋解决,能说下吗?我也遇到了这个问题,搞了好久才看到你这个帖子
    sunziren
        4
    sunziren  
    OP
       Oct 29, 2020
    @dustinyjj mybatis 依赖的版本问题,换个更高的
    dustinyjj
        6
    dustinyjj  
       Oct 29, 2020
    可以了,感谢老哥!!!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1049 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 44ms · UTC 18:46 · PVG 02:46 · LAX 11:46 · JFK 14:46
    ♥ Do have faith in what you're doing.