想实现这样一个查询, 我知道某个字段的长度。。查询字段长度=?的所有记录
select * from table where 字段长度=?
不知道有没有这样的函数,看了半天帮助没找到
如果没有,这样的查询怎么实现呢?

解决方案 »

  1.   

    Lz还是看下JDBC吧~ 需要连接数据库后再执行SQL语句
    public static Connection getConnection()
          throws SQLException, IOException
       {  
          Properties props = new Properties();
          FileInputStream in = new FileInputStream("database.properties");
          props.load(in);
          in.close();      String drivers = props.getProperty("jdbc.drivers");
          if (drivers != null) System.setProperty("jdbc.drivers", drivers);
          String url = props.getProperty("jdbc.url");
          String username = props.getProperty("jdbc.username");
          String password = props.getProperty("jdbc.password");      return DriverManager.getConnection(url, username, password);
       }
      

  2.   

    select 字段 from table where LENGTH(字段)=?
    我在informix数据库里这个语句是适用的,不知道对于标准SQL语句能不能通用。