Chapter7 - Producing Readable Output With iSQLPlus
Chapter7 - Producing Readable Output With iSQLPlus
Objectives
After completing this lesson, you should be able to do the following: Produce queries that require a substitution variable
Customize the iSQL*Plus environment Produce more readable output Create and execute script files
7-2
Substitution Variables
User
7-3
Substitution Variables
DEFINE command
Pass variable values between SQL statements Dynamically alter headers and footers
7-4
7-5
2
101
7-6
7-7
7-8
7-9
If you need to predefine a variable that includes spaces, you must enclose the value within single quotation marks when using the DEFINE command. A defined variable is available for the session
7-10
DEFINE job_title = IT_PROG DEFINE job_title DEFINE JOB_TITLE = "IT_PROG" (CHAR) UNDEFINE job_title DEFINE job_title SP2-0135: symbol job_title is UNDEFINED
7-11
SELECT employee_id, last_name, salary, department_id FROM employees7 WHERE employee_id = &employee_num ;
7-12
Use the VERIFY command to toggle the display of the substitution variable, before and after iSQL*Plus replaces substitution variables with values.
SET VERIFY ON SELECT employee_id, last_name, salary, department_id FROM employees WHERE employee_id = &employee_num;
old new
3: WHERE 3: WHERE
7-14
7-15
7-16
[column option] [text | OFF | ON] [text | OFF | ON] [ON report_element]
7-17
CLE[AR]: Clears any column formats HEA[DING] text: Sets the column heading FOR[MAT] format: Changes the display of the column using a format model NOPRINT | PRINT NULL
7-18
7-19
Element 9
Description Single zero-suppression digit Enforces leading zero Floating dollar sign Local currency Position of decimal point Thousand separator
Example 999999
Result 1234
0 $ L . ,
7-20
7-21
TTI[TLE] [text|OFF|ON]
TTITLE 'Salary|Report'
BTITLE 'Confidential'
7-22
TTI[TLE] [text|OFF|ON]
TTITLE 'Salary|Report'
BTITLE 'Confidential'
7-23
7-24
7-25
Sample Report
7-26
Sample Report
7-27
Summary
Use iSQL*Plus substitution variables to store values temporarily Use SET commands to control the current iSQL*Plus environment Use the COLUMN command to control the display of a column Use the BREAK command to suppress duplicates and divide rows into sections Use the TTITLE and BTITLE commands to display headers and footers
7-28
Practice 7 Overview
Creating a query to display values using substitution variables Starting a command file containing variables
7-29