select count(*) from user_tables where table_name='XXX' 表名大写

解决方案 »

  1.   

    select count(*) from tab where tname=upper('xxx');
    如果大于0则存在,反之...
      

  2.   

    select count(*) from user_tables where table_name='tableName'
    楼得上的都回答了
    来晚了
      

  3.   

    to sasacat(傻傻猫)有没有类似于if exists....之类的话阿?谢谢
      

  4.   

    直接 select * from user_tables where table_name='tableName'就可以了,没该表他就提示对象不存在.
      

  5.   

    to  sasacat(傻傻猫) ( 
    if exists ....
      create table .....
    else
      create table 
    end if
      

  6.   

    declare 
    str varchar(1000);
    i integer;
    begin
     select count(*) into i from user_tables where table_name='XXX'; if i=1 then
      str := 'create table1 ...';
     else
        str := 'create table ...';
     end if;
     execute immediate str;
    end;/
      

  7.   

    CREATE OR REPLACE FUNCTION ISEXISTTABLE
    (sTableName VARCHAR2) 
    RETURN INT 
    IS 
      iCount INTEGER; 
      sUpperName VARCHAR2(200); 
     BEGIN 
      sUpperName:=Upper(sTableName); 
      Select Count(*) Into iCount from sys.all_tables 
         Where Upper(Table_Name)=sUpperName and owner=SYS_CONTEXT('USERENV', 'CURRENT_SCHEMA') and RowNum=1; 
      Return iCount; 
    END;
      

  8.   

    楼上的说的对,可以用exist(select....)判断。
      

  9.   

    select * from all_all_tables where TABLE_NAME='表名'