oracle批量插入从序列中获得值后,插入两张表(注意pl/sql脚本)

oracle序列专门用来生成递增的值

表:USER_RESC_INFO 权限

表:user_post_resc 关联中间表

序列:SEQ_USER_RESC_INFO

代码如下:

insert into USER_RESC_INFO values (SEQ_USER_RESC_INFO.NEXTVAL, 1012, 'USER_UNIT_ADD', '新增',2, 'platform/user/toEditUserGroup.action',1, 1, null, null, null, 2);
commit;
insert into user_post_resc values(3,(select max(resc_id) from USER_RESC_INFO));
commit;
 
insert into USER_RESC_INFO values (SEQ_USER_RESC_INFO.NEXTVAL, 1012, 'USER_UNIT_EDIT', '修改',2, 'platform/user/toEditUserGroup.action',1, 1, null, null, null, 2);
commit;
insert into user_post_resc values(3,(select max(resc_id) from USER_RESC_INFO));
commit;

insert into USER_RESC_INFO values (SEQ_USER_RESC_INFO.NEXTVAL, 1012, 'USER_UNIT_UP', '启用',2, 'platform/user/updateGroupStatus.action',1, 1, null, null, null, 2);
commit;
insert into user_post_resc values(3,(select max(resc_id) from USER_RESC_INFO));
commit;

insert into USER_RESC_INFO values (SEQ_USER_RESC_INFO.NEXTVAL, 1012, 'USER_UNIT_DOWN', '禁用',2, 'platform/user/updateGroupStatus.action',1, 1, null, null, null, 2);
commit;
insert into user_post_resc values(3,(select max(resc_id) from USER_RESC_INFO));
commit;

insert into USER_RESC_INFO values (SEQ_USER_RESC_INFO.NEXTVAL, 1012, 'USER_UNIT_OFF', '注销',2, 'platform/user/updateGroupStatus.action',1, 1, null, null, null, 2);
commit;
insert into user_post_resc values(3,(select max(resc_id) from USER_RESC_INFO));
commit;



commit 用来使用orcle提交事务的。

草木全
分享到:
共 0 条  此列表为空  当前1/1页

© 2014 究问社区 copyRight 豫ICP备13003319号-1