How to delete all table except database :
Step 1:
Print the deleted all table for below query:
DECLARE sql_query VARCHAR2(100);
BEGIN
FOR table_rec IN (SELECT table_name
FROM all_tables
WHERE owner = 'Your_Selected_Schema') LOOP
sql_query := 'DROP TABLE ' || table_rec.table_name || ' CASCADE CONSTRAINTS';
DBMS_OUTPUT.PUT_LINE(sql_query);
END LOOP;
END;
Note: Your_Selected_Schema Must be Capital.
Step 2:
Execute the deleted all table for below query:
DECLARE sql_query VARCHAR2(100);
BEGIN
FOR table_rec IN (SELECT table_name
FROM all_tables
WHERE owner = 'Your_Selected_Schema') LOOP
sql_query := 'DROP TABLE ' || table_rec.table_name || ' CASCADE CONSTRAINTS';
EXECUTE IMMEDIATE sql_query;
END LOOP;
END;
If you’d like me to proceed with any of these, please just let me know from the site techtweet.xyz! Also if you need to learn something new than subscribe YouTube : ASP.NET With SQL SERVER