当前位置:Gxlcms > 数据库问题 > ibatis 批量插入oracle总结

ibatis 批量插入oracle总结

时间:2021-07-01 10:21:17 帮助过:28人阅读


UNION, INTERSECT, or MINUS set operator
■ The WHERE clause of a SELECT statement
■ The DEFAULT value of a column in a CREATE TABLE or ALTER TABLE statement
■ The condition of a CHECK constrain

参考(连接没法放上去,因为提示内容违禁 http://www.+++ w2bc +++.com/Article/18614, 访问时把加号去掉)

应该是上面标红的那条导致的,大致意思是 用union 连接的两个select 不能使用序列

但是我们看到在单个select 是可以使用的,

select Seq_a.nextval , null from dual 是正确的 。。

dual 可以是任何表,包括视图,那我们就先把 所有select 用union all 连接后组成一个视图,

然后使用这个视图查询就可以了。。。

修改如下

insert into a (id,name) 

select SEQ_A.nextval, t. * from (

<iterate conjunction="UNION ALL"  property="d">

select #d[].name# from dual

</iterate>

) t 

正常运行。。。

 

同时注意 
SELECT id,name FROM (select SEQ_B_LOG_ID.NEXTVAL id , ‘elong_deo‘ name from dual);

这样也是不对的,违反第二条,在被查询的视图中使用序号

可以改成

select  SEQ_B_LOG_ID.NEXTVAL id,name from (select ‘elong_deo‘ name from dual);

 

3. --- The error occurred while applying a parameter map.
--- Check the doInsertFlightDynamic-InlineParameterMap.
--- Check the statement (update failed).
--- Cause: java.sql.SQLSyntaxErrorException: ORA-01745: 无效的主机/绑定变量名

sql语句中,两个填充变量间没有写逗号

 

ibatis 批量插入oracle总结

标签:upd   简单   rac   rate   获取   测试   acl   rom   ati   

人气教程排行