Delete a table if it exists : Drop Table « Table « Oracle PL / SQL






Delete a table if it exists

   

SQL> BEGIN
  2    FOR i IN (SELECT null FROM user_tables WHERE table_name = 'INDIVIDUALS') LOOP
  3      EXECUTE IMMEDIATE 'DROP TABLE individuals CASCADE CONSTRAINTS';
  4    END LOOP;
  5  END;
  6  /

PL/SQL procedure successfully completed.

   
    
    
  








Related examples in the same category

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