昨天写了一个很废的代码
create procedure batch_cargo()
language SQL
begin
declare in_date date;
declare his_date date;
declare p_tj_date varchar(8);
declare p_his_date varchar(8);
declare p_tj_year varchar(4);
declare p_tj_month varchar(2);
declare p_tj_day varchar(2);
declare p_his_year varchar(4);
declare p_his_month varchar(2);
declare p_his_day varchar(2);
set in_date = current date -1 day;
set his_date = current date -10 day;
set p_tj_year = trim(char(year(in_date)));
set p_tj_month =
case when month(in_date)<10 then '0'||trim(char(month(in_date))) else trim(char(month(in_date))) end;
set p_tj_day =
case when day(in_date)<10 then '0'||trim(char(day(in_date))) else trim(char(day(in_date))) end;
set p_tj_date = p_tj_year || p_tj_month || p_tj_day;
set p_his_year = trim(char(year(his_date)));
set p_his_month =
case when month(his_date)<10 then '0'||trim(char(month(his_date))) else trim(char(month(his_date))) end;
set p_his_day =
case when day(his_date)<10 then '0'||trim(char(day(his_date))) else trim(char(day(his_date))) end;
set p_his_date = p_his_year || p_his_month || p_his_day;
insert into t_test_proc values(p_tj_date,p_his_date);
end@
过程在执行时,提示应用程序堆不够用了,SQLSTATE = 57011
后来修改了两个参数SORTHEAP、APPLHEAPSZ然后就正常了。
下列是在IBM中看到的参数说明
db2 get db cfg |grep HEAP db2 update db cfg for dbname using SORTHEAP 2048 db2 update db cfg for dbname using APPLHEAPSZ 2024
数据库堆(4KB) (DBHEAP) = 1200 实用程序堆大小(4KB) (UTIL_HEAP_SZ) = 5000 最大应用程序控制堆大小(4KB) (APP_CTL_HEAP_SZ) = 128 排序列表堆(4KB) (SORTHEAP) = 2500 SQL 语句堆(4KB) (STMTHEAP) = 2048 缺省应用程序堆(4KB) (APPLHEAPSZ) = 2048 统计信息堆大小(4KB) (STAT_HEAP_SZ) = 4384