create procedure pro
as
str varchar2(50);
num number;
begin
select 1 into num from test;
str:='drop table test';--grant drop any table to new_user
execute immediate str;
str:='create table TEST(A VARCHAR(10),B INT)';--grant create any table to new_user
execute immediate str;
exception
when other then
str:='create table TEST(A VARCHAR(10),B INT)';--grant create any table to new_user
execute immediate str;
end;
/

解决方案 »

  1.   

    TO beckhambobo(beckham)
      请教select 1 into num from test;是什么意思呢?
    exception
    when other then
    str:='create table TEST(A VARCHAR(10),B INT)'
    execute immediate str;
    还有这句例外情况下的语句,似乎只是再建了表TEST,
    而没有将数据恢复啊?
    请赐教。
      

  2.   

    哥们在ORACLE中是不可以这样写的?
    把exists 改为别的函数
     如:select count(*) into v_int  from sysobjects where name='test'
        然后if v_int >0 
    即可。
      

  3.   

    关键是你的select语句有问题,在包中你不能写没有目的select语句,楼上的写的很对