exec sql中,若表不存在则create这个表.
我本来是这样写的 exec sql select count(*) into :i from cdr2009052400;
printf("%d\n",i);
exec sql select count(*) into :i from cdr2009052300;
printf("%d\n",i);         cdr2009052400表是存在的,但是没有数据,cdr2009052300是不存在的,         但是printf后i的值都是0,这样无法判断表是否存在啊请教一下各位大侠, 还有什么别的方法??谢谢谢谢~~

解决方案 »

  1.   

    查字典表
    select table_name from dba_tables where table_name=upper('表名');
      

  2.   

    select table_name from user_tables where table_name='CDR2009052400'return code 是0 表示存在,
    return code 是100 表示不存在,
      

  3.   

    select * from user_tables
      

  4.   

    select count(1) into i from user_tables where table_name='表名大写';
      

  5.   


    select table_name from user_tables where table_name='ttt' 正解。
      

  6.   

    select count(*) into :i from tab where tname=upper('cdr2009052400'); 
      

  7.   

    请教一下为什么会有 user_tables not found.的错误呢??