my_decimal *Item_param::val_decimal(my_decimal *dec)
{
  // There's no "default". See comments in Item_param::save_in_field().
  switch (state) {
  case DECIMAL_VALUE:
    return &decimal_value;
  case REAL_VALUE:
    double2my_decimal(E_DEC_FATAL_ERROR, value.real, dec);
    return dec;
  case INT_VALUE:
    int2my_decimal(E_DEC_FATAL_ERROR, value.integer, unsigned_flag, dec);
    return dec;
  case STRING_VALUE:
  case LONG_DATA_VALUE:
    return decimal_from_string_with_check(dec, &str_value);
  case TIME_VALUE:
  {
    return TIME_to_my_decimal(&value.time, dec);
  }
  case IGNORE_VALUE:
  case DEFAULT_VALUE:
    invalid_default_param();
    // fall through
  case NULL_VALUE:
    return 0;
  case NO_VALUE:
    DBUG_ASSERT(0); // Should not be possible
    return 0;
  }
  DBUG_ASSERT(0); // Gabrage
  return 0;
}
my_decimal *Item_param::val_decimal(my_decimal *dec)
{
   
  switch (state) {
  case DECIMAL_VALUE:
    return &decimal_value;
  case REAL_VALUE:
    double2my_decimal(E_DEC_FATAL_ERROR, value.real, dec);
    return dec;
  case INT_VALUE:
    int2my_decimal(E_DEC_FATAL_ERROR, value.integer, unsigned_flag, dec);
    return dec;
  case STRING_VALUE:
  case LONG_DATA_VALUE:
    return decimal_from_string_with_check(dec, &str_value);
  case TIME_VALUE:
  {
    return TIME_to_my_decimal(&value.time, dec);
  }
  case IGNORE_VALUE:
  case DEFAULT_VALUE:
    invalid_default_param();
     
  case NULL_VALUE:
    return 0;
  case NO_VALUE:
    DBUG_ASSERT(0);  
    return 0;
  }
  DBUG_ASSERT(0);  
  return 0;
}