declare v_cnt Number;
begin
select count(*) into v_cnt from user_tables where table_name = TABLENAME;
if v_cnt>0 then
dbms_output.put_line('該表存在!');
else
dbms_output.put_line('該表不存在或當前用戶無權訪問!');
end If;
End;
注意:表名要大寫,在這裏是區分大小寫的。Oracle創建的表名全是大寫。
寫於 2010-10-15