I've got the next spool that stores the DDL of the user_tables
into a file:
set pagesize 0
set long 90000
spool C:\Users\personal\Desktop\MAIN_USR\test.txt
select DBMS_METADATA.GET_DDL('TABLE',table_name,'MAIN_USR')
FROM user_tables ut;
spool off
exit
It returns the DDL of all user_tables
into a single file, but I need it to be a little more dynamic and return them in separate files with the file name of their respective table. Something like this:
set pagesize 0
set long 90000
FOR tab_nam IN (SELECT table_name FROM user_tables) LOOP
spool C:\Users\personal\Desktop\MAIN_USR\test.txt
select DBMS_METADATA.GET_DDL('TABLE',table_name,'MAIN_USR')
FROM user_tables ut;
spool off
END LOOP;
exit
I know the one above won't work, but it's kind of an idea of what I want to do.
I appreciate any kind of help