Convert a Result Set from SQL Array to Array of Strings

前端 未结 5 1966
鱼传尺愫
鱼传尺愫 2020-12-02 22:43

I am querying the information_schema.columns table in my PostgreSQL database. Using a table name, the result set finds all the column names, type, and whether i

5条回答
  •  醉梦人生
    2020-12-02 23:31

    this can be helpful

    Object[] balance = (Object[]) ((Array) attributes[29]).getArray();
            for (Object bal : balance) {
    
                Object [] balObj =(Object[]) ((Array) bal).getArray();
                for(Object obj : balObj){
                    Struct s= (Struct)obj;
                    if(s != null ){
                        String [] str = (String[]) s.getAttributes();
                        System.out.println(str);
                    }
    
                }
    
            }
    

提交回复
热议问题