Code Generation using Oracle SQL*Plus

I mentioned the requirements for code generation by calling stored procedures from sqlplus in a previous post, but plus needs more fine-tuning to create nice source code files:

set serveroutput on format wrapped;

“format wrapped” maintains spaces in the output file.

set feedback off;

suppresses the message “PL/SQL procedure successfully completed” (found here)

set trimspool on;

trims trailing spaces in the spool file

set linesize 200;

sets maximum line length before wrapping to new line (max. 32767)

spool C:\path\to\my\output.txt

sets output file name (= spool file)

exec my_proc();

generate code using dbms_output.put_line() statements

spool off

end of code generation

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: