SlideShare uma empresa Scribd logo
1 de 27
Producing Readable Output with iSQL*Plus  http://ecomputernotes.com
Objectives  After completing this lesson, you should be able to  do the following:  "  Produce queries that require a substitution  variable  "  Customize the   i SQL*Plus environment  "  Produce more readable output  "  Create and execute script files  http://ecomputernotes.com
Substitution Variables  I want to query  different values.  ... salary =  ? «  « department_id = ? «  ... last_name = ? ...  User  http://ecomputernotes.com
Substitution Variables  Use   i SQL*Plus substitution variables to:  "  Temporarily store values  Single ampersand ( & )  Double ampersand ( && )  ±  DEFINE   command  "  Pass variable values between SQL statements  "  Dynamically alter headers and footers  http://ecomputernotes.com
Using the   &   Substitution Variable  Use a variable prefixed with an ampersand ( & ) to prompt the user for a value.  SELECT  employee_id, last_name, salary, department_id  FRO M  employees  WHERE  employee_id = &employee_num ;  http://ecomputernotes.com
Using the   &   Substitution Variable  2  101  1  http://ecomputernotes.com
Character and Date Values  with Substitution Variables  Use single quotation marks for date and character values.  SELECT last_name, department_id, salary*12  FROM  employees  WHERE  job_id = '&job_title' ;  http://ecomputernotes.com
Specifying Column Names,  Expressions, and Text  Use substitution variables to supplement the  following:  "  WHERE   conditions  "  ORDER BY   clauses  "  Column expressions  "  Table names  "  Entire   SELECT   statements  http://ecomputernotes.com
Specifying Column Names,  Expressions, and Text  SELECT  employee_id, last_name, job_id,  &column_name  FRO M  employees  WHERE  &condition  ORDER BY  &order_column ;  http://ecomputernotes.com
Defining Substitution Variables  "Y ou can predefine variables using the  i S QL*Plus  DEFINE   command.  DEFINE   variable  =   value   creates a user  variable with the CHAR data type.  "  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  http://ecomputernotes.com
DEFINE   and   UNDEFINE   Commands  "A  variable remains defined until you either:  Use the UNDEFINE command to clear it Exit   i SQL*Plus  "Y ou can verify your changes with the  D EFINE  command.  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  http://ecomputernotes.com
Using the   DEFINE   Command with  &   Substitution Variable  "C reate the substitution variable using the  D EFINE  command.  DEFINE employee_num = 200  "  Use a variable prefixed with an ampersand ( & ) to substitute the value in the SQL statement.  SELECT employee_id, last_name, salary, department_id  FROM  employees  WHERE  employee_id = &employee_num ;  http://ecomputernotes.com
Using the   &&   Substitution Variable  Use the double-ampersand ( && ) if you want to reuse the variable value without prompting the user each  time.  SELECT  employee_id, last_name, job_id, &&column_name  FROM  employees  ORDER BY &column_name;  «  http://ecomputernotes.com
Using the   VERIFY   Command  Use the   VERIFY   command to toggle the display of the substitution variable, before and after   i SQL*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  3: WHERE  employee_id = &employee_num  new  3: WHERE  employee_id = 200  http://ecomputernotes.com
Customizing the   i SQL*Plus Environment  "U se  S ET  c ommands to control current session.  SET   system_variable value  "V erify what you have set by using the  S H O W  command.  SET ECHO  ON  SHOW ECHO  echo ON  http://ecomputernotes.com
SET   Command Variables  "  ARRAYSIZE  {20 |   n }  "  FEEDBACK  {6 |  n   |OFF | ON}  "  HEADING  {OFF | ON}  "  LONG  {80 |   n }| ON |   text }  SET HEADING OFF  SHOW HEADING HEADING OFF  http://ecomputernotes.com
i SQL*Plus Format Commands  "  COLUMN [ column option ]  "  TTITLE [ text  | OFF | ON]  "  BTITLE [ text  | OFF | ON]  "  BREAK  [ON   report_element ]
The   COLUMN   Command  Controls display of a column:  COL[UMN] [{ column || alias } [ option ]]]]  "  CLE[AR]: Clears any column formats  "  HEA[DING]   text : Sets the column heading  "F OR[MAT]  f ormat:  Changes the display of the  column using a format model  "  NOPRINT | PRINT  "  NULL
Using the   COLUMN   Command  "C reate column headings.  COLUMN last_name HEADING 'Employee|Name' COLUMN salary JUSTIFY LEFT FORMAT $99,990.00 COLUMN manager FORMAT 999999999 NULL 'No manager'  "  Display the current setting for the   LAST_NAME  column.  COLUMN last_name  "C lear settings for the  L AST_NAME  c olumn.  COLUMN last_name CLEAR
COLUMN   Format Models  Element  Description  Example  Result  9  Single zero-suppression  999999  1234  digit  0  Enforces leading zero  099999  001234  $  Floating dollar sign  $9999  $1234  L  Local currency  L9999  L1234  Position of decimal point  9999.99  1234.00  ,  Thousand separator  9,999  1,234
Using the   BREAK   Command  Use the   BREAK   command to suppress duplicates.  BREAK ON job_id
Using the   TTITLE   and   BTITLE   Commands  "D isplay headers and footers.  tex t |OFF|ON]  "S et the report header.  T TITLE 'Salary|Report'  "S et the report footer.  BTITLE 'Confidential'
Using the   TTITLE   and   BTITLE   Commands  "D isplay headers and footers.  TTI[TLE] [ text |OFF|ON]  "S et the report header.  TTITLE 'Salary|Report'  "S et the report footer.  BTITLE 'Confidential'
Creating a Script File  to Run a Report  1. Create and test the SQL   SELECT   statement. 2. Save the   SELECT   statement into a script file. 3. Load the script file into an editor.  4. Add formatting commands before the   SELECT  statement.  5. Verify that the termination character follows the   SELECT   statement.
Creating a Script File  to Run a Report  6. Clear formatting commands after the   SELECT  statement.  7. Save the script file.  8. Load the script file into the   i SQL*Plus text window, and click the Execute button.
Sample Report  «
Sample Report  «

Mais conteúdo relacionado

Mais procurados

Introduction to oracle functions
Introduction to oracle functionsIntroduction to oracle functions
Introduction to oracle functionsNitesh Singh
 
SQL select statement and functions
SQL select statement and functionsSQL select statement and functions
SQL select statement and functionsVikas Gupta
 
1. dml select statement reterive data
1. dml select statement reterive data1. dml select statement reterive data
1. dml select statement reterive dataAmrit Kaur
 
SQL Tuning Overview
SQL Tuning OverviewSQL Tuning Overview
SQL Tuning OverviewKai Liu
 
Prabu's sql quries
Prabu's sql quries Prabu's sql quries
Prabu's sql quries Prabu Cse
 
Introduction To Oracle Sql
Introduction To Oracle SqlIntroduction To Oracle Sql
Introduction To Oracle SqlAhmed Yaseen
 
Oracle - Program with PL/SQL - Lession 18
Oracle - Program with PL/SQL - Lession 18Oracle - Program with PL/SQL - Lession 18
Oracle - Program with PL/SQL - Lession 18Thuan Nguyen
 
Myth busters - performance tuning 101 2007
Myth busters - performance tuning 101 2007Myth busters - performance tuning 101 2007
Myth busters - performance tuning 101 2007paulguerin
 
Enterprise Data Validation
Enterprise Data ValidationEnterprise Data Validation
Enterprise Data ValidationKevin Hazzard
 
My sql Syntax
My sql SyntaxMy sql Syntax
My sql SyntaxReka
 
Oracle - Program with PL/SQL - Lession 11
Oracle - Program with PL/SQL - Lession 11Oracle - Program with PL/SQL - Lession 11
Oracle - Program with PL/SQL - Lession 11Thuan Nguyen
 
SignalR & SQL Dependency
SignalR & SQL DependencySignalR & SQL Dependency
SignalR & SQL DependencyNarato
 
Oracle - Program with PL/SQL - Lession 10
Oracle - Program with PL/SQL - Lession 10Oracle - Program with PL/SQL - Lession 10
Oracle - Program with PL/SQL - Lession 10Thuan Nguyen
 
Oracle SQL Functions
Oracle SQL FunctionsOracle SQL Functions
Oracle SQL FunctionsA Data Guru
 
Single-Row Functions in orcale Data base
Single-Row Functions in orcale Data baseSingle-Row Functions in orcale Data base
Single-Row Functions in orcale Data baseSalman Memon
 

Mais procurados (20)

Introduction to oracle functions
Introduction to oracle functionsIntroduction to oracle functions
Introduction to oracle functions
 
SQL select statement and functions
SQL select statement and functionsSQL select statement and functions
SQL select statement and functions
 
Les01
Les01Les01
Les01
 
form view
form viewform view
form view
 
1. dml select statement reterive data
1. dml select statement reterive data1. dml select statement reterive data
1. dml select statement reterive data
 
Lab5 sub query
Lab5   sub queryLab5   sub query
Lab5 sub query
 
SQL Tuning Overview
SQL Tuning OverviewSQL Tuning Overview
SQL Tuning Overview
 
Prabu's sql quries
Prabu's sql quries Prabu's sql quries
Prabu's sql quries
 
Introduction To Oracle Sql
Introduction To Oracle SqlIntroduction To Oracle Sql
Introduction To Oracle Sql
 
Oracle - Program with PL/SQL - Lession 18
Oracle - Program with PL/SQL - Lession 18Oracle - Program with PL/SQL - Lession 18
Oracle - Program with PL/SQL - Lession 18
 
Myth busters - performance tuning 101 2007
Myth busters - performance tuning 101 2007Myth busters - performance tuning 101 2007
Myth busters - performance tuning 101 2007
 
Babitha2.mysql
Babitha2.mysqlBabitha2.mysql
Babitha2.mysql
 
Enterprise Data Validation
Enterprise Data ValidationEnterprise Data Validation
Enterprise Data Validation
 
My sql Syntax
My sql SyntaxMy sql Syntax
My sql Syntax
 
Oracle - Program with PL/SQL - Lession 11
Oracle - Program with PL/SQL - Lession 11Oracle - Program with PL/SQL - Lession 11
Oracle - Program with PL/SQL - Lession 11
 
SignalR & SQL Dependency
SignalR & SQL DependencySignalR & SQL Dependency
SignalR & SQL Dependency
 
Oracle - Program with PL/SQL - Lession 10
Oracle - Program with PL/SQL - Lession 10Oracle - Program with PL/SQL - Lession 10
Oracle - Program with PL/SQL - Lession 10
 
Oracle SQL Functions
Oracle SQL FunctionsOracle SQL Functions
Oracle SQL Functions
 
Single-Row Functions in orcale Data base
Single-Row Functions in orcale Data baseSingle-Row Functions in orcale Data base
Single-Row Functions in orcale Data base
 
Oracle: Procedures
Oracle: ProceduresOracle: Procedures
Oracle: Procedures
 

Semelhante a e computer notes - Producing readable output with i sql plus

Les08-Oracle
Les08-OracleLes08-Oracle
Les08-Oraclesuman1248
 
Oracle - Program with PL/SQL - Lession 03
Oracle - Program with PL/SQL - Lession 03Oracle - Program with PL/SQL - Lession 03
Oracle - Program with PL/SQL - Lession 03Thuan Nguyen
 
e computer notes - Writing basic sql select statements
e computer notes - Writing basic sql select statementse computer notes - Writing basic sql select statements
e computer notes - Writing basic sql select statementsecomputernotes
 
e computer notes - Creating views
e computer notes - Creating viewse computer notes - Creating views
e computer notes - Creating viewsecomputernotes
 
Oracle - Program with PL/SQL - Lession 09
Oracle - Program with PL/SQL - Lession 09Oracle - Program with PL/SQL - Lession 09
Oracle - Program with PL/SQL - Lession 09Thuan Nguyen
 
Chinabankppt
ChinabankpptChinabankppt
Chinabankpptnewrforce
 
Les02 (restricting and sorting data)
Les02 (restricting and sorting data)Les02 (restricting and sorting data)
Les02 (restricting and sorting data)Achmad Solichin
 
e computer notes - Subqueries
e computer notes - Subqueriese computer notes - Subqueries
e computer notes - Subqueriesecomputernotes
 
e computer notes - Single row functions
e computer notes - Single row functionse computer notes - Single row functions
e computer notes - Single row functionsecomputernotes
 
Plsql coding conventions
Plsql coding conventionsPlsql coding conventions
Plsql coding conventionsFang Yu
 
e computer notes - Restricting and sorting data
e computer notes -  Restricting and sorting datae computer notes -  Restricting and sorting data
e computer notes - Restricting and sorting dataecomputernotes
 
e computer notes - Creating and managing tables
e computer notes -  Creating and managing tablese computer notes -  Creating and managing tables
e computer notes - Creating and managing tablesecomputernotes
 
e computer notes - Using set operator
e computer notes - Using set operatore computer notes - Using set operator
e computer notes - Using set operatorecomputernotes
 
Les01 (retrieving data using the sql select statement)
Les01 (retrieving data using the sql select statement)Les01 (retrieving data using the sql select statement)
Les01 (retrieving data using the sql select statement)Achmad Solichin
 
Oracle - Program with PL/SQL - Lession 01
Oracle - Program with PL/SQL - Lession 01Oracle - Program with PL/SQL - Lession 01
Oracle - Program with PL/SQL - Lession 01Thuan Nguyen
 
Oracle - Program with PL/SQL - Lession 07
Oracle - Program with PL/SQL - Lession 07Oracle - Program with PL/SQL - Lession 07
Oracle - Program with PL/SQL - Lession 07Thuan Nguyen
 
Open Gurukul Language PL/SQL
Open Gurukul Language PL/SQLOpen Gurukul Language PL/SQL
Open Gurukul Language PL/SQLOpen Gurukul
 

Semelhante a e computer notes - Producing readable output with i sql plus (20)

Les07
Les07Les07
Les07
 
Les08-Oracle
Les08-OracleLes08-Oracle
Les08-Oracle
 
Oracle - Program with PL/SQL - Lession 03
Oracle - Program with PL/SQL - Lession 03Oracle - Program with PL/SQL - Lession 03
Oracle - Program with PL/SQL - Lession 03
 
e computer notes - Writing basic sql select statements
e computer notes - Writing basic sql select statementse computer notes - Writing basic sql select statements
e computer notes - Writing basic sql select statements
 
e computer notes - Creating views
e computer notes - Creating viewse computer notes - Creating views
e computer notes - Creating views
 
Oracle - Program with PL/SQL - Lession 09
Oracle - Program with PL/SQL - Lession 09Oracle - Program with PL/SQL - Lession 09
Oracle - Program with PL/SQL - Lession 09
 
Chinabankppt
ChinabankpptChinabankppt
Chinabankppt
 
Les02
Les02Les02
Les02
 
Les02 (restricting and sorting data)
Les02 (restricting and sorting data)Les02 (restricting and sorting data)
Les02 (restricting and sorting data)
 
e computer notes - Subqueries
e computer notes - Subqueriese computer notes - Subqueries
e computer notes - Subqueries
 
e computer notes - Single row functions
e computer notes - Single row functionse computer notes - Single row functions
e computer notes - Single row functions
 
Plsql coding conventions
Plsql coding conventionsPlsql coding conventions
Plsql coding conventions
 
e computer notes - Restricting and sorting data
e computer notes -  Restricting and sorting datae computer notes -  Restricting and sorting data
e computer notes - Restricting and sorting data
 
e computer notes - Creating and managing tables
e computer notes -  Creating and managing tablese computer notes -  Creating and managing tables
e computer notes - Creating and managing tables
 
e computer notes - Using set operator
e computer notes - Using set operatore computer notes - Using set operator
e computer notes - Using set operator
 
Sql dml & tcl 2
Sql   dml & tcl 2Sql   dml & tcl 2
Sql dml & tcl 2
 
Les01 (retrieving data using the sql select statement)
Les01 (retrieving data using the sql select statement)Les01 (retrieving data using the sql select statement)
Les01 (retrieving data using the sql select statement)
 
Oracle - Program with PL/SQL - Lession 01
Oracle - Program with PL/SQL - Lession 01Oracle - Program with PL/SQL - Lession 01
Oracle - Program with PL/SQL - Lession 01
 
Oracle - Program with PL/SQL - Lession 07
Oracle - Program with PL/SQL - Lession 07Oracle - Program with PL/SQL - Lession 07
Oracle - Program with PL/SQL - Lession 07
 
Open Gurukul Language PL/SQL
Open Gurukul Language PL/SQLOpen Gurukul Language PL/SQL
Open Gurukul Language PL/SQL
 

Mais de ecomputernotes

computer notes - Data Structures - 30
computer notes - Data Structures - 30computer notes - Data Structures - 30
computer notes - Data Structures - 30ecomputernotes
 
computer notes - Data Structures - 39
computer notes - Data Structures - 39computer notes - Data Structures - 39
computer notes - Data Structures - 39ecomputernotes
 
computer notes - Data Structures - 11
computer notes - Data Structures - 11computer notes - Data Structures - 11
computer notes - Data Structures - 11ecomputernotes
 
computer notes - Data Structures - 20
computer notes - Data Structures - 20computer notes - Data Structures - 20
computer notes - Data Structures - 20ecomputernotes
 
computer notes - Data Structures - 15
computer notes - Data Structures - 15computer notes - Data Structures - 15
computer notes - Data Structures - 15ecomputernotes
 
Computer notes - Including Constraints
Computer notes - Including ConstraintsComputer notes - Including Constraints
Computer notes - Including Constraintsecomputernotes
 
Computer notes - Date time Functions
Computer notes - Date time FunctionsComputer notes - Date time Functions
Computer notes - Date time Functionsecomputernotes
 
Computer notes - Subqueries
Computer notes - SubqueriesComputer notes - Subqueries
Computer notes - Subqueriesecomputernotes
 
Computer notes - Other Database Objects
Computer notes - Other Database ObjectsComputer notes - Other Database Objects
Computer notes - Other Database Objectsecomputernotes
 
computer notes - Data Structures - 28
computer notes - Data Structures - 28computer notes - Data Structures - 28
computer notes - Data Structures - 28ecomputernotes
 
computer notes - Data Structures - 19
computer notes - Data Structures - 19computer notes - Data Structures - 19
computer notes - Data Structures - 19ecomputernotes
 
computer notes - Data Structures - 31
computer notes - Data Structures - 31computer notes - Data Structures - 31
computer notes - Data Structures - 31ecomputernotes
 
computer notes - Data Structures - 4
computer notes - Data Structures - 4computer notes - Data Structures - 4
computer notes - Data Structures - 4ecomputernotes
 
computer notes - Data Structures - 13
computer notes - Data Structures - 13computer notes - Data Structures - 13
computer notes - Data Structures - 13ecomputernotes
 
Computer notes - Advanced Subqueries
Computer notes -   Advanced SubqueriesComputer notes -   Advanced Subqueries
Computer notes - Advanced Subqueriesecomputernotes
 
Computer notes - Aggregating Data Using Group Functions
Computer notes - Aggregating Data Using Group FunctionsComputer notes - Aggregating Data Using Group Functions
Computer notes - Aggregating Data Using Group Functionsecomputernotes
 
computer notes - Data Structures - 16
computer notes - Data Structures - 16computer notes - Data Structures - 16
computer notes - Data Structures - 16ecomputernotes
 
computer notes - Data Structures - 22
computer notes - Data Structures - 22computer notes - Data Structures - 22
computer notes - Data Structures - 22ecomputernotes
 
computer notes - Data Structures - 35
computer notes - Data Structures - 35computer notes - Data Structures - 35
computer notes - Data Structures - 35ecomputernotes
 
computer notes - Data Structures - 36
computer notes - Data Structures - 36computer notes - Data Structures - 36
computer notes - Data Structures - 36ecomputernotes
 

Mais de ecomputernotes (20)

computer notes - Data Structures - 30
computer notes - Data Structures - 30computer notes - Data Structures - 30
computer notes - Data Structures - 30
 
computer notes - Data Structures - 39
computer notes - Data Structures - 39computer notes - Data Structures - 39
computer notes - Data Structures - 39
 
computer notes - Data Structures - 11
computer notes - Data Structures - 11computer notes - Data Structures - 11
computer notes - Data Structures - 11
 
computer notes - Data Structures - 20
computer notes - Data Structures - 20computer notes - Data Structures - 20
computer notes - Data Structures - 20
 
computer notes - Data Structures - 15
computer notes - Data Structures - 15computer notes - Data Structures - 15
computer notes - Data Structures - 15
 
Computer notes - Including Constraints
Computer notes - Including ConstraintsComputer notes - Including Constraints
Computer notes - Including Constraints
 
Computer notes - Date time Functions
Computer notes - Date time FunctionsComputer notes - Date time Functions
Computer notes - Date time Functions
 
Computer notes - Subqueries
Computer notes - SubqueriesComputer notes - Subqueries
Computer notes - Subqueries
 
Computer notes - Other Database Objects
Computer notes - Other Database ObjectsComputer notes - Other Database Objects
Computer notes - Other Database Objects
 
computer notes - Data Structures - 28
computer notes - Data Structures - 28computer notes - Data Structures - 28
computer notes - Data Structures - 28
 
computer notes - Data Structures - 19
computer notes - Data Structures - 19computer notes - Data Structures - 19
computer notes - Data Structures - 19
 
computer notes - Data Structures - 31
computer notes - Data Structures - 31computer notes - Data Structures - 31
computer notes - Data Structures - 31
 
computer notes - Data Structures - 4
computer notes - Data Structures - 4computer notes - Data Structures - 4
computer notes - Data Structures - 4
 
computer notes - Data Structures - 13
computer notes - Data Structures - 13computer notes - Data Structures - 13
computer notes - Data Structures - 13
 
Computer notes - Advanced Subqueries
Computer notes -   Advanced SubqueriesComputer notes -   Advanced Subqueries
Computer notes - Advanced Subqueries
 
Computer notes - Aggregating Data Using Group Functions
Computer notes - Aggregating Data Using Group FunctionsComputer notes - Aggregating Data Using Group Functions
Computer notes - Aggregating Data Using Group Functions
 
computer notes - Data Structures - 16
computer notes - Data Structures - 16computer notes - Data Structures - 16
computer notes - Data Structures - 16
 
computer notes - Data Structures - 22
computer notes - Data Structures - 22computer notes - Data Structures - 22
computer notes - Data Structures - 22
 
computer notes - Data Structures - 35
computer notes - Data Structures - 35computer notes - Data Structures - 35
computer notes - Data Structures - 35
 
computer notes - Data Structures - 36
computer notes - Data Structures - 36computer notes - Data Structures - 36
computer notes - Data Structures - 36
 

Último

HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)cama23
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
Food processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture honsFood processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture honsManeerUddin
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationRosabel UA
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 

Último (20)

HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
Food processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture honsFood processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture hons
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translation
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 

e computer notes - Producing readable output with i sql plus

  • 1. Producing Readable Output with iSQL*Plus http://ecomputernotes.com
  • 2. Objectives After completing this lesson, you should be able to do the following: " Produce queries that require a substitution variable " Customize the i SQL*Plus environment " Produce more readable output " Create and execute script files http://ecomputernotes.com
  • 3. Substitution Variables I want to query different values. ... salary = ? « « department_id = ? « ... last_name = ? ... User http://ecomputernotes.com
  • 4. Substitution Variables Use i SQL*Plus substitution variables to: " Temporarily store values Single ampersand ( & ) Double ampersand ( && ) ± DEFINE command " Pass variable values between SQL statements " Dynamically alter headers and footers http://ecomputernotes.com
  • 5. Using the & Substitution Variable Use a variable prefixed with an ampersand ( & ) to prompt the user for a value. SELECT employee_id, last_name, salary, department_id FRO M employees WHERE employee_id = &employee_num ; http://ecomputernotes.com
  • 6. Using the & Substitution Variable 2 101 1 http://ecomputernotes.com
  • 7. Character and Date Values with Substitution Variables Use single quotation marks for date and character values. SELECT last_name, department_id, salary*12 FROM employees WHERE job_id = '&job_title' ; http://ecomputernotes.com
  • 8. Specifying Column Names, Expressions, and Text Use substitution variables to supplement the following: " WHERE conditions " ORDER BY clauses " Column expressions " Table names " Entire SELECT statements http://ecomputernotes.com
  • 9. Specifying Column Names, Expressions, and Text SELECT employee_id, last_name, job_id, &column_name FRO M employees WHERE &condition ORDER BY &order_column ; http://ecomputernotes.com
  • 10. Defining Substitution Variables "Y ou can predefine variables using the i S QL*Plus DEFINE command. DEFINE variable = value creates a user variable with the CHAR data type. " 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 http://ecomputernotes.com
  • 11. DEFINE and UNDEFINE Commands "A variable remains defined until you either: Use the UNDEFINE command to clear it Exit i SQL*Plus "Y ou can verify your changes with the D EFINE command. 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 http://ecomputernotes.com
  • 12. Using the DEFINE Command with & Substitution Variable "C reate the substitution variable using the D EFINE command. DEFINE employee_num = 200 " Use a variable prefixed with an ampersand ( & ) to substitute the value in the SQL statement. SELECT employee_id, last_name, salary, department_id FROM employees WHERE employee_id = &employee_num ; http://ecomputernotes.com
  • 13. Using the && Substitution Variable Use the double-ampersand ( && ) if you want to reuse the variable value without prompting the user each time. SELECT employee_id, last_name, job_id, &&column_name FROM employees ORDER BY &column_name; « http://ecomputernotes.com
  • 14. Using the VERIFY Command Use the VERIFY command to toggle the display of the substitution variable, before and after i SQL*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 3: WHERE employee_id = &employee_num new 3: WHERE employee_id = 200 http://ecomputernotes.com
  • 15. Customizing the i SQL*Plus Environment "U se S ET c ommands to control current session. SET system_variable value "V erify what you have set by using the S H O W command. SET ECHO ON SHOW ECHO echo ON http://ecomputernotes.com
  • 16. SET Command Variables " ARRAYSIZE {20 | n } " FEEDBACK {6 | n |OFF | ON} " HEADING {OFF | ON} " LONG {80 | n }| ON | text } SET HEADING OFF SHOW HEADING HEADING OFF http://ecomputernotes.com
  • 17. i SQL*Plus Format Commands " COLUMN [ column option ] " TTITLE [ text | OFF | ON] " BTITLE [ text | OFF | ON] " BREAK [ON report_element ]
  • 18. The COLUMN Command Controls display of a column: COL[UMN] [{ column || alias } [ option ]]]] " CLE[AR]: Clears any column formats " HEA[DING] text : Sets the column heading "F OR[MAT] f ormat: Changes the display of the column using a format model " NOPRINT | PRINT " NULL
  • 19. Using the COLUMN Command "C reate column headings. COLUMN last_name HEADING 'Employee|Name' COLUMN salary JUSTIFY LEFT FORMAT $99,990.00 COLUMN manager FORMAT 999999999 NULL 'No manager' " Display the current setting for the LAST_NAME column. COLUMN last_name "C lear settings for the L AST_NAME c olumn. COLUMN last_name CLEAR
  • 20. COLUMN Format Models Element Description Example Result 9 Single zero-suppression 999999 1234 digit 0 Enforces leading zero 099999 001234 $ Floating dollar sign $9999 $1234 L Local currency L9999 L1234 Position of decimal point 9999.99 1234.00 , Thousand separator 9,999 1,234
  • 21. Using the BREAK Command Use the BREAK command to suppress duplicates. BREAK ON job_id
  • 22. Using the TTITLE and BTITLE Commands "D isplay headers and footers. tex t |OFF|ON] "S et the report header. T TITLE 'Salary|Report' "S et the report footer. BTITLE 'Confidential'
  • 23. Using the TTITLE and BTITLE Commands "D isplay headers and footers. TTI[TLE] [ text |OFF|ON] "S et the report header. TTITLE 'Salary|Report' "S et the report footer. BTITLE 'Confidential'
  • 24. Creating a Script File to Run a Report 1. Create and test the SQL SELECT statement. 2. Save the SELECT statement into a script file. 3. Load the script file into an editor. 4. Add formatting commands before the SELECT statement. 5. Verify that the termination character follows the SELECT statement.
  • 25. Creating a Script File to Run a Report 6. Clear formatting commands after the SELECT statement. 7. Save the script file. 8. Load the script file into the i SQL*Plus text window, and click the Execute button.