For formatting the output
- PAGESIZE - this controls the numbers of rows displayed between displaying headers. Usually I set it to 1000 (which means that I have got headers only once) and for some scripts for 0 (which means no headers at all)
- LINESIZE - this controls the line width in characters in which a row is fit in. Default 80 fits to default terminal settings. The best shape of data for me is the model 1 row per line, so I often modify this to get such result
- TRIMOUT - for cutting off unnecessary spaces filling lines
- COL
FOR a - for formatting character columns - COL
FOR 999999 - for formatting number columns - LONG - for setting how much of LOBs to show on the display - very useful especially with DBMS_METADATA.GET_DDL calls
- HEAD - for turning on and off the headers - important for scripts, when we want some values from within the database - then sqlplus -s /nolog with CONNECT command
For testing purposes
- FEEDBACK - for turning on and off a message at the end of display summarizing the number of affected rows or PL/SQL command status (SUCCESS|FAILURE)
- TIME - enables time in sqlprompt, which may be used as a marker for script performance
- TIMING - returns information about performance time for operations
For scripts creating scripts
- SQLPROMPT - cool for identifying terminals, when one works on plenty of environments (especially when some of them are production ones), but even cooler as "---> " when it comes to the creation of SQL scripts - prompt messages in the spool are seen as comments
For executing scripts
- TERMOUT - this works only if one calls commands from underlying script - very important for long-running scripts with plenty of output with enabled spooling, when on terminal output we need only command and information about success or error messages.
- SPOOL - for logging
- TRIMSPOOL - useful especially with connection to wide LINESIZE - in order to remove unnecessary spaces (with them logs become very large)
- SERVEROUTPUT - for turning on|off printing from PL/SQL to screen
- ECHO - turns on|off the lines with replaced &variables
No comments:
Post a Comment