johnicesea 2011-08-18 05:41
浏览 466
已采纳

关于ibatis insert里嵌套select

我想写这么句sql,insert into table(a,....) values( select b from table_b where c='xx',....)

现在在ibatis里,
我在xml文件里这么写

insert into table(a,....) values( select b from table_b where c=#property#,....)

property是ClassA的一个属性,但是执行报错,ORA-00936: missing expression,

看ibatis生成的sql是
[color=red][preparestatement]: insert into table(a,....) values( ?,....) [/color]
然后在?处绑定的是select b from table_b where c='xx'
但我要的效果是
[color=red][preparestatement]: insert into table(a,....) values( select b from table_b where c=?,....)[/color]
接触ibatis不久,不知道问题有没有说清楚,希望各位帮忙说下这个应该怎么写。

p.s.用的是ibatis2.3

  • 写回答

1条回答 默认 最新

  • iteye_18182 2011-08-18 06:31
    关注

    你是SQL写错了吧。
    insert into table_a (aa,bb) (selece aa,bb from table_b)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?