oracle(sql) 表名改成大写

declare
 tablename1 varchar2(100);
 str varchar2(100);
 cursor c_mycursor is
  select table_name from all_tab_comments where owner ='XYADMIN' and table_type = 'TABLE';
begin
  open c_mycursor;
  loop
    fetch c_mycursor into tablename1;
    exit when c_mycursor%notfound;
    if tablename1 <> upper(tablename1) then
      str:='alter table XYADMIN."'||tablename1||'" rename to '||tablename1;
      execute immediate str;
    end if;
  end loop;
  close c_mycursor;
end;
posted @ 2011-01-06 19:02  小さいです哥  阅读(421)  评论(0编辑  收藏  举报