ALTER FUNCTION "dba"."get_u_nimi5"(in a_id_user integer)
returns char(40)
begin
  declare ls_return char(40);
  select Left(trim(trim(t_user.first_name)+' '+trim(t_user.last_name)),40) into ls_return from t_user where t_user.id_user = a_id_user;
  if ls_return is null or Length(Trim(ls_return)) = 0 then
    select trim(t_user.username) into ls_return from t_user where t_user.id_user = a_id_user
  end if;
  if ls_return is null then
    set ls_return=''
  end if;
  return(ls_return)
end