Oracle 1Z0-007: Producing Readable Output with iSQL*Plus

Valid XHTML 1.0!

Producing Readable Output with iSQL*Plus

Produce queries that require a substitution variable.

Produce more readable output.

This can be done with various variables, like PAGESIZE,HEADING,etc.The most common one is defining a column name so that it takes up a certain space on the screen.

column nombres format a15;
column appedllidos format a15;
column direccion format a30;

Create and execute script files.

One of the most commonly used commands in SQL*Plus in order to produce a more readable output is:
column: <column name> and format: a <size of column>.

This command is commonly declared in the login scripts for columns in tables that are heavily accessed, so it provides a more cleaner display. Other variables are also used, following is the creation of a script within SQL*Plus. =

SQL> SET PAGESIZE 0 /*(Turns off all page formating information ( columns,headings,page breaks,etc) )*/
SQL> SET HEADING OFF /*( Turns off the display of column headings )*/
SQL> SET FEEDBACK OFF /*( Suppresses the display of the number of rows retuned by the query)*/
SQL> SET VERIFY OFF /*( Does not display the text of a SQL command before and after SQL*Plus replaces substitution variables with values )*/
SQL> SET ECHO OFF /*(Suppresses the listing of SQL commands in the eliminartablas.sql as they are executed)*/
SQL> SPOOL eliminartablas.sql /*(Starts spooling and saving commands entered at the SQL*Plus prompt and query results into the file eliminartablas.sql)*/
SQL> Select 'DELETE ' || TABLE_NAME ||';'
    FROM DBA_TABLES
    WHERE OWNER='DANIEL';
    DELETE ACCTS;
    DELETE ACCT_ADDRS;
    |
    |
    |
    DELETE STOCKS;
SQL>SPOOL OFF /*(Stops spooling and closes the file eliminartablas.sql)
Now if the script eliminartables.sql is run it will delete every table from the select statment.*/




Updated: July 30, 2005; Joe Gakenheimer