首先写一个存储过程:
create or replace procedure p_syn_equipment_20161205 is sqlstr varchar2(4000); begin --清空表 sqlstr := 'truncate table staff_20161205'; execute immediate sqlstr; --插入数据 sqlstr := 'insert into staff_20161205 select * from tb_base_staff s where s.staff_name like ''王%'' '; execute immediate sqlstr; commit; end;
在xml文件中调用
无参数:
<select id="queryStaffs" parameterType="java.util.Map"> <![CDATA[ call p_syn_equipment_20161205() ]]> </select>
有参数:
<select id="createOssEquipment" parameterType="java.util.Map"> <![CDATA[ call P_SYNCOSSEQUIPMENT(#{jndi,mode=IN,jdbcType=VARCHAR}, #{res_spec_id,mode=IN,jdbcType=VARCHAR}) ]]> </select>
<select id="createDynamicOssEquipment" parameterType="java.util.Map"> <![CDATA[ call P_SYNC_DYNAMIC_OSSEQUIPMENT(#{jndi,mode=IN,jdbcType=VARCHAR}) ]]> </select>