Java SQL Type isNumericType(int datatype)

Here you can find the source of isNumericType(int datatype)

Description

Check if the given SQL type is numeric data type

License

Open Source License

Parameter

Parameter Description
datatype a parameter

Declaration

public static boolean isNumericType(int datatype) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2005, 2010 Sybase, Inc. and others
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors://  w ww . j a  v a 2s.  co m
 *    Sybase, Inc. - initial API and implementation
 *******************************************************************************/

import java.sql.Types;

public class Main {
    /**
     * Check if the given SQL type is numeric data type
     * @param datatype
     * @return
     */
    public static boolean isNumericType(int datatype) {
        return datatype == Types.BIGINT || datatype == Types.DECIMAL || datatype == Types.DOUBLE
                || datatype == Types.FLOAT || datatype == Types.INTEGER || datatype == Types.NUMERIC
                || datatype == Types.REAL || datatype == Types.SMALLINT || datatype == Types.TINYINT;
    }
}

Related

  1. isNumeric(int dataType)
  2. isNumeric(int dataType)
  3. isNumeric(int pColumnType)
  4. isNumeric(int sqlType)
  5. isNumeric(int sqlType)
  6. isNumericType(int type)
  7. isPlainJdbcType(int type)
  8. isPrecisionRequired(int jdbcType)
  9. isPrimitive(Class type)