/**
   * Tell whether this numeric type can be converted to the given type.
   *
   * @param otherType The TypeId of the other type.
   * @param forDataTypeFunction was this called from a scalarFunction like CHAR() or DOUBLE()
   */
  public boolean numberConvertible(TypeId otherType, boolean forDataTypeFunction) {

    // Can't convert numbers to long types
    if (otherType.isLongConcatableTypeId()) return false;

    // Numbers can only be converted to other numbers,
    // and CHAR, (not VARCHARS or LONGVARCHAR).
    // Only with the CHAR() or VARCHAR()function can they be converted.
    boolean retval =
        ((otherType.isNumericTypeId()) || (otherType.isBooleanTypeId()) || (otherType.userType()));

    // For CHAR  Conversions, function can convert
    // Floating types
    if (forDataTypeFunction)
      retval = retval || (otherType.isFixedStringTypeId() && (getTypeId().isFloatingPointTypeId()));

    retval = retval || (otherType.isFixedStringTypeId() && (!getTypeId().isFloatingPointTypeId()));

    return retval;
  }