DB2编程序技巧 (七)
2020-01-31 14:53:44
供稿:网友
正在看的db2教程是:DB2编程序技巧 (七)。3.4 查看sp使用了哪些表
select bname from syscat.packagedep where btype='T' and pkgname in(select bname from sysibm.sysdependencies where dname in (select specificname from syscat.procedures where procname='PR_CLEAR_MATCH_DIVIDE_SHA'))
3.5 查看function被哪些sp使用
select PROCNAME from SYSCAT.PROCEDURES where SPECIFICNAME in(select dname from sysibm.sysdependencies where bname in ( select PKGNAME from syscat.packagedep where bname in (select SPECIFICNAME from SYSCAT.functions where funcname='GET_CURRENT_DATE')))
使用function时要注意,如果想drop 掉该function必须要先将调用该function的其它存储过程全部drop掉。
必须先创建function,调用该function的sp才可以创建成功。
3.6 修改表结构
一次给一个表增加多个字段
db2 "alter table tb_test add column t1 char(1) add column t2 char(2) add column t3 int"
4 DB2系统管理
4.1 DB2安装
在Windows 98 下安装db2 7.1 或其他版本,如果有Jdbc错误或者是Windwos 98不能启动,则将autoexec.bat 中的内容用如下内容替换:
C:/PROGRA~1/TRENDP~1/PCSCAN.EXE C:/ C:/WINDOWS/COMMAND/ /NS /WIN95
rem C:/WINDOWS/COMMAND.COM /E:32768
REM [Header]
REM [CD-ROM Drive]
REM [Miscellaneous]
REM [Display]
set PATH=%PATH%;C:/MSSQL/BINN;C:/PROGRA~1/SQLLIB/BIN;C:/PROGRA~1/SQLLIB/FUNCTION;C:/PROGRA~1/SQLLIB/SAMPLES/REPL;C:/PROGRA~1/SQLLIB/HELP
IF EXIST C:/PROGRA~1/IBM/IMNNQ/IMQENV.BAT CALL C:/PROGRA~1/IBM/IMNNQ/IMQENV.BAT
IF EXIST C:/PROGRA~1/IBM/IMNNQ/IMNENV.BAT CALL C:/PROGRA~1/IBM/IMNNQ/IMNENV.BAT
set DB2INSTANCE=DB2
set CLASSPATH=.;C:/PROGRA~1/SQLLIB/java/db2java.zip;C:/PROGRA~1/SQLLIB/java/runtime.zip;C:/PROGRA~1/SQLLIB/java/sqlj.zip;C:/PROGRA~1/SQLLIB/bin
set MDIS_PROFILE=C:/PROGRA~1/SQLLIB/METADATA/PROFILES
set LC_ALL=ZH_CN
set INCLUDE=C:/PROGRA~1/SQLLIB/INCLUDE;C:/PROGRA~1/SQLLIB/LIB;C:/PROGRA~1/SQLLIB/TEMPLATES/INCLUDE
set LIB=C:/PROGRA~1/SQLLIB/LIB
set DB2PATH=C:/PROGRA~1/SQLLIB
set DB2TEMPDIR=C:/PROGRA~1/SQLLIB
set VWS_TEMPLATES=C:/PROGRA~1/SQLLIB/TEMPLATES
set VWS_LOGGING=C:/PROGRA~1/SQLLIB/LOGGING
set VWSPATH=C:/PROGRA~1/SQLLIB
set VWS_FOLDER=IBM DB2
set ICM_FOLDER=信息目录管理器
win
<