If view exists, drop view : USER_VIEWS « System Tables Views « Oracle PL / SQL






If view exists, drop view

  

SQL>
SQL> BEGIN
  2    FOR i IN (SELECT null FROM user_views WHERE view_name = 'BOOKS_emp') LOOP
  3      EXECUTE IMMEDIATE 'DROP VIEW books_emp';
  4    END LOOP;
  5  END;
  6  /

PL/SQL procedure successfully completed.

   
    
  








Related examples in the same category

1.Query user_views
2.Query user-defined view info from USER_VIEWS table
3.Get all views
4.List view text from user_views