DB2中的57011問題
昨天寫了一個很廢的代碼
Sql代碼
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中看到的參數說明
數據庫堆(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