user1651063
user1651063

Reputation: 11

Oracle Spool Script Output To Table

Is there any way to spool .sql script output to table?

One workaround I can think is to spool to filesystem by creating dynamically an insert-statements script with the feedback and then run this against your schema.

However, I would like to know if there is a better solution to spool directly into table or a system table which already exists and stores this info (for example script filepath, execution date, execution results ; 1 row inserted, commit etc...

Thanks

Upvotes: 1

Views: 2460

Answers (1)

Rob van Laarhoven
Rob van Laarhoven

Reputation: 8905

Write the spool file to a directory where you have defined an Oracle Directory. Write a procedure that takes a filename and a directory name as input and that writes the file as a CLOB into a table.

spool test.txt

your code

spool off

exec write_spool_file_to_database_proc('test.txt','YOURDIR');

Take a look at this on how to write a file into a table CLOB column.

http://www.roeptoeter.nl/?p=254

Upvotes: 1

Related Questions