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

我的第一个oracle存储过程,麻烦大家帮帮忙谢谢拉
基本过程是这样的
create   or   replace   procedure   sp_test
As
begin
      execute   immediate   'create     Global   temporary   Table   t1(ip   Varchar2(10),Time   Date)
      ON   COMMIT   DELETE   ROWS ';
      execute   immediate   'Select   ip_addr,Max(indb_time)   a   Into   t1   From   t2   Group   By   ip_addr ';
       
          update   t3
            Set   t3.ctime=t1.time
            where   t3.ip_addr=t1.ip;
        commit;
   
    exception
      when   others   then
      DBMS_OUTPUT.PUT_LINE(to_char(sqlerrm));

end;

就是想实现从t2中把ip和max(time)取出来,然后根据对应的ip分别把值插入t3中,
但是调试老出错,麻烦大家帮忙指点一下,谢谢

------解决方案--------------------
是你建立sp_lin_test2过程的Oracle帐户权限不够,用system帐户连接后,将“create any table”权限授予该帐户即可。语法如下:
grant create any table to 建立过程的帐户名称