question about interval data type

                 create a table with interval year column, and query it by jdbc 
interface, and the column type in the result is interval?why not interval year?

stmt = connection.createStatement();
stmt.execute("drop table trafodion.seabase.test_intervalyear");
stmt.execute("create table trafodion.seabase.test_intervalyear(c1 interval 
year)");
DatabaseMetaData dbmd = connection.getMetaData();
rs = dbmd.getColumns("TRAFODION", "SEABASE", "TEST_INTERVALYEAR", "%");
int colnum = 8;//rs.getMetaData().getColumnCount();
String colname = null;
for (int i=1; i<=colnum; i++) {
    colname = rs.getMetaData().getColumnName(i);
    System.out.print(colname);
    System.out.print(", ");
if (colname == null) {
for (int j=0; j<10; j++) {
            System.out.print(" ");
        }
    } else {
for (int j = 0; j < (16 - colname.length()); j++) {
            System.out.print(" ");
        }
    }
}
System.out.println();
while (rs.next()) {
for (int i=1; i<=colnum; i++) {
        colname = rs.getString(i);
        System.out.print(colname);
        System.out.print(", ");
if (colname == null) {
for (int j=0; j<10; j++) {
                System.out.print(" ");
            }
        } else {
for (int j = 0; j < (16 - colname.length()); j++) {
                System.out.print(" ");
            }
        }
    }
    System.out.println();


}    

result:

TABLE_CAT,        TABLE_SCHEM,      TABLE_NAME,             COLUMN_NAME,      
DATA_TYPE,        TYPE_NAME,        COLUMN_SIZE,      BUFFER_LENGTH,    


TRAFODION,        SEABASE,          TEST_INTERVALYEAR,     C1,                  
          101,                      INTERVAL,             1,                    
       34,  

Reply via email to