Created
November 30, 2018 08:02
-
-
Save FleXoft/9e6c1bea9c0167bf6c099a9a6bc87475 to your computer and use it in GitHub Desktop.
Oracle loop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE CURSOR c_drop IS | |
SELECT table_name | |
FROM dba_tables | |
WHERE owner = '<sm séma neve>'; | |
v_sql VARCHAR2(800); | |
BEGIN | |
FOR r IN c_drop | |
LOOP | |
v_sql := 'DROP TABLE '|| r.owner||'.'|| r.table_name||' cascade constraints' to prx_test'; | |
dbms_output.put_line(v_sql); | |
BEGIN | |
EXECUTE IMMEDIATE v_sql; | |
EXCEPTION WHEN OTHERS THEN dbms_output.put_line(dbms_utility.format_error_backtrace ); | |
END; | |
END LOOP; | |
END; | |
/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment