Skip to Main Content
Oracle SQL*Plus: The Definitive Guide
book

Oracle SQL*Plus: The Definitive Guide

by Jonathan Gennick
March 1999
Intermediate to advanced content levelIntermediate to advanced
528 pages
14h 39m
English
O'Reilly Media, Inc.
Content preview from Oracle SQL*Plus: The Definitive Guide

Executing a Script

Most of this chapter has focused on what you need to know in order to enter a command directly into SQL*Plus and have it executed. Another option available to you is to have SQL*Plus execute a script. A script is simply a text file that contains one or more statements to execute. When SQL*Plus executes a script, the commands or statements in the file are executed just as if you had typed them in directly from the keyboard. A script file can contain any combination of valid SQL*Plus commands, SQL statements, or PL/SQL blocks.

The START command is used to execute a script. Here is the syntax to use:

START filename [arg1
            
                
            arg2
            
                
            arg3...]

where:

STA[RT]

May be abbreviated to STA.

filename

Is the name of the script file you want to execute. The default extension is .SQL.

arg1 arg2 arg3

Represent any command-line arguments you want to pass to the script file. These are delimited by spaces, and you may specify as many as are needed by the script. Arguments containing spaces should be enclosed in either single or double quotes.

Let’s say you had a file named DESCRIBE_ALL.SQL, and it contained the following SQL*Plus commands:

DESCRIBE employee
DESCRIBE project
DESCRIBE project_hours

You could execute this file with the START command as shown here:

SQL> START C:\JONATHAN\SQL_PLUS_BOOK\XB_CH_2\DESCRIBE_ALL Name Null? Type ------------------------------- -------- ---- EMPLOYEE_ID NOT NULL NUMBER EMPLOYEE_NAME VARCHAR2(40) EMPLOYEE_HIRE_DATE DATE EMPLOYEE_TERMINATION_DATE DATE EMPLOYEE_BILLING_RATE ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Oracle SQL*Plus: The Definitive Guide, 2nd Edition

Oracle SQL*Plus: The Definitive Guide, 2nd Edition

Jonathan Gennick
Oracle PL/SQL Programming, Third Edition

Oracle PL/SQL Programming, Third Edition

Steven Feuerstein, Bill Pribyl
Oracle SQL

Oracle SQL

Dan Hotka

Publisher Resources

ISBN: 1565925785Supplemental ContentCatalog PageErrata