日期:2014-05-16 浏览次数:20430 次
select 'insert into USERMGR.TS_USER_ROLE(USER_ID, ROLE_ID) values (' || user_id || ', ' || ?role_id || ');' from (
? select distinct user_id, role_id from usermgr.ts_user_org_position uop, usermgr.ts_position p, usermgr.ts_role r
? where uop.position_id=p.position_id and p.position_code=r.role_code
);
?
执行以上语句,会生成对应的insert语句:
insert into USERMGR.TS_USER_ROLE(USER_ID, ROLE_ID) values (239, 1176);
insert into USERMGR.TS_USER_ROLE(USER_ID, ROLE_ID) values (419, 724);
insert into USERMGR.TS_USER_ROLE(USER_ID, ROLE_ID) values (14627, 722);
insert into USERMGR.TS_USER_ROLE(USER_ID, ROLE_ID) values (14410, 721);
insert into USERMGR.TS_USER_ROLE(USER_ID, ROLE_ID) values (877, 721);
insert into USERMGR.TS_USER_ROLE(USER_ID, ROLE_ID) values (511, 721);
insert into USERMGR.TS_USER_ROLE(USER_ID, ROLE_ID) values (431, 721);
insert into USERMGR.TS_USER_ROLE(USER_ID, ROLE_ID) values (649, 720);