Drop only if table exists. : Drop Table « Table « Oracle PL / SQL






Drop only if table exists.

   
SQL> BEGIN
  2
  3    FOR i IN (SELECT table_name FROM user_tables WHERE table_name = 'SHARED_ALL') LOOP
  4      EXECUTE IMMEDIATE 'DROP TABLE shared_all';
  5    END LOOP;
  6
  7  END;
  8  /

PL/SQL procedure successfully completed.

SQL>

   
    
    
  








Related examples in the same category

1.Drop a table demo
2.Drop table with CASCADE CONSTRAINTS
3.Delete a table if it exists