概述
----Mybaits调用db2存储过程
<update id="changeTableName" parameterType="java.util.Map" statementType="CALLABLE">
call PRO_RENAME_TABLE_CONSTRUCT(
#{tableName,jdbcType=VARCHAR,mode=IN},
#{tableLikeName,jdbcType=VARCHAR,mode=IN}
)
</update>
<update id="createTableByLike" parameterType="java.util.Map" statementType="CALLABLE">
call PRO_COPY_TABLE_CONSTRUCT(
#{tableName,jdbcType=VARCHAR,mode=IN},
#{tableLikeName,jdbcType=VARCHAR,mode=IN}
)
</update>
<update id="dropTableByTableName" parameterType="java.util.Map" statementType="CALLABLE">
call PRO_DROP_TABLE(#{tableName,jdbcType=VARCHAR,mode=IN})
</update>
SET CURRENT SCHEMA = LOY;
SET CURRENT PATH = SYSIBM,SYSFUN,SYSPROC,SYSIBMADM,LOY;
CREATE OR REPLACE PROCEDURE LOY.PRO_COPY_TABLE_CONSTRUCT (
IN TABLEA VARCHAR(1000),
IN TABLEB VARCHAR(1000) )
SPECIFIC SQL181018205715057
LANGUAGE SQL
NOT DETERMINISTIC
EXTERNAL ACTION
MODIFIES SQL DATA
CALLED ON NULL INPUT
INHERIT SPECIAL REGISTERS
OLD SAVEPOINT LEVEL
--创建存储过程
根据B表的表结构,创建表A
BEGIN
declare sSql varchar(1000) ;
set sSql='create table '||tableA||' like '||tableB;
prepare s1 from sSql;
EXECUTE s1;
END;
SET CURRENT SCHEMA = LOY;
SET CURRENT PATH = SYSIBM,SYSFUN,SYSPROC,SYSIBMADM,LOY;
CREATE OR REPLACE PROCEDURE LOY.PRO_RENAME_TABLE_CONSTRUCT (
IN TABLEA VARCHAR(1000),
IN TABLEB VARCHAR(1000) )
SPECIFIC SQL181019104542563
LANGUAGE SQL
NOT DETERMINISTIC
EXTERNAL ACTION
MODIFIES SQL DATA
CALLED ON NULL INPUT
INHERIT SPECIAL REGISTERS
OLD SAVEPOINT LEVEL
–创建存储过程 修改表明,将表名A改为表名B
BEGIN
declare sSql varchar(1000) ;
set sSql='rename table '||tableA||' to '||tableB;
prepare s1 from sSql;
EXECUTE s1;
END;
SET CURRENT SCHEMA = LOY;
SET CURRENT PATH = SYSIBM,SYSFUN,SYSPROC,SYSIBMADM,LOY;
CREATE OR REPLACE PROCEDURE LOY.PRO_DROP_TABLE ( IN TABLEA VARCHAR(1000) )
SPECIFIC SQL181019104816965
LANGUAGE SQL
NOT DETERMINISTIC
EXTERNAL ACTION
MODIFIES SQL DATA
CALLED ON NULL INPUT
INHERIT SPECIAL REGISTERS
OLD SAVEPOINT LEVEL
–创建存储过程 修改表明,将表名A改为表名B
BEGIN
declare sSql varchar(1000) ;
set sSql='drop table '||tableA;
prepare s1 from sSql;
EXECUTE s1;
end;
==========================
结束语:不积跬步无以至千里,不积小流无以成江河
V: 18612372242 欢迎交流指点。
最后
以上就是香蕉雨为你收集整理的DB2 存储过程复制表结构、重命名表、删除表实现,及Mybatis如何调用的全部内容,希望文章能够帮你解决DB2 存储过程复制表结构、重命名表、删除表实现,及Mybatis如何调用所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复