private Object convertNumeric(Object srcObj, int srcType,
    int trgType) throws SQLException {

        if (srcType == trgType) {
            return srcObj;
        }

        if (isNumeric(trgType) == false && isString(trgType) == false) {
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString() + trgType);
        }

        try {
            switch (trgType) {
                case Types.BIT:
                    Integer i = Integer.valueOf(srcObj.toString().trim());
                    return i.equals(0) ?
                    Boolean.valueOf(false) :
                        Boolean.valueOf(true);
                case Types.TINYINT:
                    return Byte.valueOf(srcObj.toString().trim());
                case Types.SMALLINT:
                    return Short.valueOf(srcObj.toString().trim());
                case Types.INTEGER:
                    return Integer.valueOf(srcObj.toString().trim());
                case Types.BIGINT:
                    return Long.valueOf(srcObj.toString().trim());
                case Types.NUMERIC:
                case Types.DECIMAL:
                    return new BigDecimal(srcObj.toString().trim());
                case Types.REAL:
                case Types.FLOAT:
                    return new Float(srcObj.toString().trim());
                case Types.DOUBLE:
                    return new Double(srcObj.toString().trim());
                case Types.CHAR:
                case Types.VARCHAR:
                case Types.LONGVARCHAR:
                    return srcObj.toString();
                default:
                    throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()+ trgType);
            }
        } catch (NumberFormatException ex) {
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString() + trgType);
        }
    }
Converts the given <code>Object</code> in the Java programming language
to the standard mapping for the specified SQL target data type.
The conversion must be to a string or numeric type, but there are no
restrictions on the type to be converted.  If the source type and target
type are the same, the given object is simply returned.

@param srcObj the <code>Object</code> in the Java programming language
              that is to be converted to the target type
@param srcType the data type that is the standard mapping in SQL of the
               object to be converted; must be one of the constants in
               <code>java.sql.Types</code>
@param trgType the SQL data type to which to convert the given object;
               must be one of the following constants in
               <code>java.sql.Types</code>: <code>NUMERIC</code>,
        <code>DECIMAL</code>, <code>BIT</code>, <code>TINYINT</code>,
        <code>SMALLINT</code>, <code>INTEGER</code>, <code>BIGINT</code>,
        <code>REAL</code>, <code>DOUBLE</code>, <code>FLOAT</code>,
        <code>VARCHAR</code>, <code>LONGVARCHAR</code>, or <code>CHAR</code>
@return an <code>Object</code> value.that is
        the standard object mapping for the target SQL type
@throws SQLException if the given target type is not one of the string or
        numeric types in <code>java.sql.Types</code>
src/main/java/org/replicadb/rowset/sun/rowset/CachedRowSetImpl.java