Here you can find the source of getNumberType(Integer precision, Integer scale)
Parameter | Description |
---|---|
precision | Integer |
scale | Integer |
private static Integer getNumberType(Integer precision, Integer scale)
//package com.java2s; import java.sql.Types; public class Main { /**//from w w w. j av a 2s.c o m * getNumberType * * @param precision Integer * @param scale Integer * @return Integer */ private static Integer getNumberType(Integer precision, Integer scale) { if (precision == null) { if (scale == null) { return Types.NUMERIC; } else if (scale == 0) { return Types.BIGINT; } } else if (scale == null || scale == 0) { if (precision == 1) { return Types.BIT; } else if (precision == 3) { return Types.TINYINT; } else if (precision == 5) { return Types.SMALLINT; } else if (precision <= 10) { return Types.INTEGER; } else if (precision <= 38) { return Types.BIGINT; } } return Types.NUMERIC; } }