Sql

[ORACLE] 모든 테이블 삭제하기

iheeeee6-6 2020. 3. 9. 19:41
728x90

1.  현존하는 모든 테이블의 DROP 문을 만들어 준다. 

SELECT  'DROP TABLE ' || object_name || ' CASCADE CONSTRAINTS;'
  FROM    user_objects
WHERE   object_type = 'TABLE';

 

2.  모든 테이블의 DROP문이  출력창에 뜨게 되고 이것을 복사하여 실행한다.

 

ex)

DROP TABLE ART CASCADE CONSTRAINTS;
DROP TABLE PURCHASE CASCADE CONSTRAINTS;
DROP TABLE COMMUNITY CASCADE CONSTRAINTS;
DROP TABLE COMMENT CASCADE CONSTRAINTS;
DROP TABLE PERSONAL CASCADE CONSTRAINTS;
DROP TABLE MEMBER CASCADE CONSTRAINTS;
DROP TABLE REFUND CASCADE CONSTRAINTS;
DROP TABLE REPORT CASCADE CONSTRAINTS;
DROP TABLE COMPANY CASCADE CONSTRAINTS;
DROP TABLE RATING CASCADE CONSTRAINTS;
DROP TABLE SEAT CASCADE CONSTRAINTS;
DROP TABLE TICKET_DATE CASCADE CONSTRAINTS;
DROP TABLE ART_TIME CASCADE CONSTRAINTS;

 

'Sql' 카테고리의 다른 글

MSSQL 참고 ( +.Net ASP)  (0) 2020.07.31