CREATE FUNCTION "dba"."convert_amp"( in a_text char(500) )
RETURNS char(600)
BEGIN
  declare ls_return char(600);
  declare ll_i smallint;
  declare ls_old char(1);
  declare ls_new char(10);
  if a_text is null then
    set a_text='';
  end if;
  set ls_return=Trim(a_text);
  set ll_i=1;
  while ll_i<4 loop
    case ll_i
    when 1 then
      set ls_old = '&';
      set ls_new ='&amp;';
    when 2 then
      set ls_old = '"';
      set ls_new ='&quot;';
    when 3 then
      set ls_old = '/';
      set ls_new ='';
    end case;
    set ls_return = Replace(ls_return,ls_old,ls_new);
    set ll_i=ll_i+1;
  end loop;
  RETURN ls_return;
END