 li_increment NUMBER;
 begin
 
-  select max(ltrim(AGENDA_ITM_ID,'KC')) into ls_max_val from KRMS_AGENDA_ITM_T;
+  select max(ltrim(AGENDA_ITM_ID,'MITKC')) into ls_max_val from KRMS_AGENDA_ITM_T;
   if ls_max_val is null then
   ls_max_val := 0;
   end if;    

li_increment NUMBER;
begin

  select max(ltrim(ATTR_DEFN_ID,'KC')) into ls_max_val from KRMS_ATTR_DEFN_T;
  if ls_max_val is null then
  ls_max_val := 0;
  end if;    

li_increment NUMBER;
begin

  select max(ltrim(FUNC_ID,'MITKC')) into ls_max_val from KRMS_FUNC_T;
  if ls_max_val is null then
  ls_max_val := 0;
  end if;    
