Java SQL Type convertOracleValue(Object value, int type)

Here you can find the source of convertOracleValue(Object value, int type)

Description

convert Oracle Value

License

Open Source License

Declaration

public static Object convertOracleValue(Object value, int type) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.sql.Types;

public class Main {

    public static Object convertOracleValue(Object value, int type) {
        String s = value.toString();
        if (type == Types.NUMERIC) {
            if (s.contains(".")) {
                return Double.valueOf(s);
            }// w  ww .j  a  va 2s .c  o  m
            if (s.length() > 11) {
                return Long.valueOf(s);
            }
            if (s.length() <= 11) {
                return Integer.valueOf(s);
            }
        }
        if (type == Types.CHAR) {
            if (s.equals("1")) {
                return Boolean.TRUE;
            } else {
                return Boolean.FALSE;
            }
        }
        return value;
    }
}

Related

  1. compressType(int type)
  2. convert2MysqlType(String cls)
  3. convertBoolean(Object value, int srcType, int destType)
  4. convertKnownType(Object one, Class to)
  5. convertNumeric(Object value, int srcType, int destType)
  6. convertParam(Object oValue, Class cType, String sFieldName)
  7. convertSQLtype2JavaClassName(int type)
  8. convertStringToType(String type)
  9. convertTemporal(Object value, int srcType, int destType)