SoFunction
Updated on 2025-04-14

DB2 programming skills (7)

The db2 tutorial I am watching is: DB2 programming skills (7). 3.4 Check which tables are used by sp
select bname from  where btype='T' and pkgname in(select bname from  where dname in (select specificname from  where procname='PR_CLEAR_MATCH_DIVIDE_SHA'))
3.5 Check which sp function is used
select PROCNAME from  where SPECIFICNAME in(select dname from  where bname in ( select PKGNAME  from  where bname   in  (select SPECIFICNAME from  where funcname='GET_CURRENT_DATE')))


When using a function, be careful. If you want to drop the function, you must first drop all other stored procedures that call the function.
A function must be created first, and the sp of the function can be created successfully.
3.6 Modify the table structure
Add multiple fields to a table at a time
db2 "alter table tb_test add column t1 char(1) add column t2 char(2) add column t3 int"


4 DB2 system management
4.1 DB2 installation
Install db2 7.1 or other version under Windows 98. If there is a Jdbc error or Windwos 98 cannot start, replace the content in it with the following:


C:\PROGRA~1\TRENDP~1\ C:\ C:\WINDOWS\COMMAND\ /NS /WIN95 
rem C:\WINDOWS\ /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\ CALL C:\PROGRA~1\IBM\IMNNQ\
IF EXIST C:\PROGRA~1\IBM\IMNNQ\ CALL C:\PROGRA~1\IBM\IMNNQ\
set DB2INSTANCE=DB2
set CLASSPATH=.;C:\PROGRA~1\SQLLIB\java\;C:\PROGRA~1\SQLLIB\java\;C:\PROGRA~1\SQLLIB\java\;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=Information Directory Manager

win