使用mybatis查询mysql数据库 先调用存储过程,然后再inner join 存储过程返回的临时表出错 高手帮忙看下!
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用mybatis查询mysql数据库 先调用存储过程,然后再inner join 存储过程返回的临时表出错 高手帮忙看下!相关的知识,希望对你有一定的参考价值。
<select id="getTreeObjsV4" statementType="CALLABLE" resultType="com.gw.fundHolders.detail.domain.Result"><![CDATA[
call gettreeobjsV4(#did, #searchnodes,#depth, #lang)
]]></select>
<select id="calFundDetailsHolders" resultType="com.gw.fundHolders.detail.domain.Detail" parameterType="map"><![CDATA[
SELECT substring(b.co, 3, 6) AS fundCode,
b.c3 AS fundShort,
a.c2 AS reportDate,
c.c3 AS latestShare,
a.c3 AS holderHolds,
a.c5/10000 AS worthHolding,
a.c6/10000 AS instHolding,
a.c7 AS instProportion,
a.c14/10000 AS indHolding,
a.c15 as indProportion,
a.c12/10000 as fundHolding,
a.c13 as fundProportion,
a.c8/10000 as managerHolding,
a.c9 as managerProportion,
a.c10/10000 as holderHolding,
a.c11 as holderProportion ,
a.c16/10000 as staffHolding,
a.c17 as staffProportion,
if(b.c20 regexp '基金$',substring(b.c20, 1, CHAR_LENGTH(b.c20)-2 ),b.c20 ) as fundType,
b.c23 as fundTypeDetails,
b.c8 as fundManager,
b.c12 as fundCustodian
FROM ST25119_main a inner join gettreeobjsV4_result result on a.co=result.obj
LEFT JOIN ST25103_main b ON a.co=b.co
LEFT JOIN ST25158_main c ON a.co=c.co and a.c2=c.c1
where a.c2 =#reportDate
order by a.co
]]>
你使用mysql fount 看一下 select * from gettreeobjsV4_result
有没有问题。追问
额,我知道不存在,这个临时表是调用存储过程返回的,我在select前先调用了存储过程,肯定会产生这个临时表的,但是不知道它为么子还报这错误
追答mysql 不存在视图啊。临时表不会保存的啊。
而且,我不知道你的查询是怎么写的。你们是一次会话么?在一个事务中么?
我是在mybatis里面执行的,不是在mysql执行的
参考技术A 出错就先把错误贴出来啊,才有针对性以上是关于使用mybatis查询mysql数据库 先调用存储过程,然后再inner join 存储过程返回的临时表出错 高手帮忙看下!的主要内容,如果未能解决你的问题,请参考以下文章
mybatis调用mysql的存储过程(procedure),实现查询操作(student表中的某个年级中的总人数 select 或者 select (*))