select * from SYS.DBA_SEGMENTS WHERE OWNER = ''
and table_name = ''

解决方案 »

  1.   

    If Exists(Select * From table)
      

  2.   

    select count(*) from table
      

  3.   

    if exists (select 'a' from tables)
      

  4.   

    谢谢大家,但是好像都不好用啊。是指纯SQL语句,如果不用Count的方法。
    if exists(的方法,好像不能在单条的SQL语句里面执行啊。
      

  5.   

    呵呵,我以为是sql呢
    oracle中读取表的记录数一般也是用count,或者dba_tables.num_rows(当然不通过analyze table <name> compute statistics此列就不是正确值)
      

  6.   

    为什么不简单一些select 1 from table where rownum < 2
      

  7.   

    to antumnsun,效果同exists一样,但指关节更愿意接受.
      

  8.   

    select count(*) from tablename;
      

  9.   

    select count(*) from tablename where rownum<=1;判断语句是关键是 where rownum<=1;
    如果表中的数据有几十万,上百万条记录;不加where条件的判断,在速度上会有严重的问题。
      

  10.   

    恩,明白了,谢谢大家。我就是担心count会在数据量大的情况下有数度上的问题。