@Override
  protected void configureColumnType(Column column, ResultSet rs) throws SQLException {
    if (integerList.contains(column.getTable().getName() + "." + column.getName())) {
      column.setDataType(Types.INTEGER);
    } else {
      column.setDataType(rs.getInt("DATA_TYPE"));
    }
    column.setColumnSize(rs.getInt("COLUMN_SIZE"));
    column.setDecimalDigits(rs.getInt("DECIMAL_DIGITS"));

    // Set true, if precision should be initialize
    column.setInitPrecision(
        !((column.getDataType() == Types.DECIMAL
                || column.getDataType() == Types.NUMERIC
                || column.getDataType() == Types.REAL)
            && rs.getString("DECIMAL_DIGITS") == null));
  }
  @Override
  public List<ForeignKey> getAdditionalForeignKeys(String schemaName, Database database)
      throws DatabaseException {
    List<ForeignKey> foreignKeys = super.getAdditionalForeignKeys(schemaName, database);

    // Setting default schema name. Needed for correct statement generation
    if (schemaName == null) {
      schemaName = database.convertRequestedSchemaToSchema(schemaName);
    }

    // Create SQL statement to select all FKs in database which referenced to unique columns
    String query =
        "select uc_fk.constraint_name FK_NAME,uc_fk.owner FKTABLE_SCHEM,ucc_fk.table_name FKTABLE_NAME,ucc_fk.column_name FKCOLUMN_NAME,decode(uc_fk.deferrable, 'DEFERRABLE', 5 ,'NOT DEFERRABLE', 7 , 'DEFERRED', 6 ) DEFERRABILITY, decode(uc_fk.delete_rule, 'CASCADE', 0,'NO ACTION', 3) DELETE_RULE,ucc_rf.table_name PKTABLE_NAME,ucc_rf.column_name PKCOLUMN_NAME from all_cons_columns ucc_fk,all_constraints uc_fk,all_cons_columns ucc_rf,all_constraints uc_rf where uc_fk.CONSTRAINT_NAME = ucc_fk.CONSTRAINT_NAME and uc_fk.constraint_type='R' and uc_fk.r_constraint_name=ucc_rf.CONSTRAINT_NAME and uc_rf.constraint_name = ucc_rf.constraint_name and uc_rf.constraint_type = 'U' and uc_fk.owner = '"
            + schemaName
            + "' and ucc_fk.owner = '"
            + schemaName
            + "' and uc_rf.owner = '"
            + schemaName
            + "' and ucc_rf.owner = '"
            + schemaName
            + "'";
    Statement statement = null;
    ResultSet rs = null;
    try {
      statement =
          ((JdbcConnection) database.getConnection()).getUnderlyingConnection().createStatement();
      rs = statement.executeQuery(query);
      while (rs.next()) {
        ForeignKeyInfo fkInfo = new ForeignKeyInfo();
        fkInfo.setReferencesUniqueColumn(true);
        fkInfo.setFkName(convertFromDatabaseName(rs.getString("FK_NAME")));
        fkInfo.setFkSchema(convertFromDatabaseName(rs.getString("FKTABLE_SCHEM")));
        fkInfo.setFkTableName(convertFromDatabaseName(rs.getString("FKTABLE_NAME")));
        fkInfo.setFkColumn(convertFromDatabaseName(rs.getString("FKCOLUMN_NAME")));

        fkInfo.setPkTableName(convertFromDatabaseName(rs.getString("PKTABLE_NAME")));
        fkInfo.setPkColumn(convertFromDatabaseName(rs.getString("PKCOLUMN_NAME")));

        fkInfo.setDeferrablility(rs.getShort("DEFERRABILITY"));
        ForeignKeyConstraintType deleteRule =
            convertToForeignKeyConstraintType(rs.getInt("DELETE_RULE"));
        if (rs.wasNull()) {
          deleteRule = null;
        }
        fkInfo.setDeleteRule(deleteRule);
        foreignKeys.add(generateForeignKey(fkInfo, database, foreignKeys));
      }
    } catch (SQLException e) {
      throw new DatabaseException(
          "Can't execute selection query to generate list of foreign keys", e);
    } finally {
      JdbcUtils.closeResultSet(rs);
      JdbcUtils.closeStatement(statement);
    }
    return foreignKeys;
  }
  /** Oracle specific implementation */
  @Override
  protected void getColumnTypeAndDefValue(Column columnInfo, ResultSet rs, Database database)
      throws SQLException, DatabaseException {
    super.getColumnTypeAndDefValue(columnInfo, rs, database);

    // Exclusive setting for oracle INTEGER type
    // Details:
    // INTEGER means NUMBER type with 'data_precision IS NULL and scale = 0'
    if (columnInfo.getDataType() == Types.INTEGER) {
      columnInfo.setTypeName("INTEGER");
    }

    String columnTypeName = rs.getString("TYPE_NAME");
    if ("VARCHAR2".equals(columnTypeName)) {
      int charOctetLength = rs.getInt("CHAR_OCTET_LENGTH");
      int columnSize = rs.getInt("COLUMN_SIZE");
      if (columnSize == charOctetLength) {
        columnInfo.setLengthSemantics(Column.LengthSemantics.BYTE);
      } else {
        columnInfo.setLengthSemantics(Column.LengthSemantics.CHAR);
      }
    }
  }