9.30.2010

SQL PLUS

Display the Full content of a LOB column:
SQL> set long 30000
SQL> show long
long 30000


SQL*Plus Location: SQL plus is typically located in $ORACLE_HOME/bin/sqlplus.

Important SQL*Plus Commands:

COLUMN: Change display width of a column. Ex: column USERNAME format a10
CONNECT: Connect to a database as a specified user. Ex: connect username/password@SID
COPY: Copy data from a query into a table (local or remote)
EXECUTE: Run a single PLSQL statement
SET: Display or change SQL*Plus settings
SHUTDOWN: To Shutdown a database instance.

SQLPLUS:
STARTUP: Startup a database instance.
SHOW: List the value of a system variable

More commands

Display Current settings:

SQL> show arraysize
SQL> show all

Formating Output:

1. Set
SQL> set pages 20
SQL> set linesize 130

2. Column Formatting
SQL> column USERNAME format a10

SQL> column colum_name alias alias_name
SQL> column colum_name clear
SQL> column colum_name heading header_text
SQL> column colum_name justify left
SQL> column colum_name justify right
SQL> column colum_name justify center
SQL> column colum_name print
SQL> column colum_name noprint
SQL> column colum_name old_value
SQL> column colum_name on
SQL> column colum_name off
SQL> column colum_name truncated


Operating System commands:

HOST command is used to issue commands to the operating system.

SQL> host bash
SQL> host cat update_ua.log

cat is Bash command line for Linux. Which display the contents of a file.

Database initialization parameters:

The initialization parameter values can be viewed with the SQL*Plus show parameter command.

column NAME_COL_PLUS_SHOW_PARAM format a35
column VALUE_COL_PLUS_SHOW_PARAM format a35

SQL> show parameters

To see the parameter's value:
SQL> show parameter parameter_name
SQL> show parameter global_names

More information