日期:2014-05-17  浏览次数:20846 次

这个语句有什么问题?
SQL code
    Declare 
    tablename nvarchar2(32);
    CURSOR  cur1 is 
    select to_char(OBJECT_NAME) from all_objects where owner='SYSTEM' and to_char(created,'YYYY-MM-DD')='2011-06-08' and object_type='TABLE'; 

    begin
         if cur1%isopen = false then
              Open cur1;
         end if; 

                Loop                    
                        FETCH cur1 INTO tablename;                                                
                        Exit when cur1%NOTFOUND;            
                        execute immediate('DROP TABLE '||tablename) ; -- 这里提示无效SQL语句                                  
                End Loop;
          
                Close cur1;
  end;


------解决方案--------------------
tablename nvarchar2(32);

类型不对,变成以下形式。

tablename varchar2(32);