SQL*Plus User’s Guide and Reference - Oracle

SQL*Plus?

User's Guide and Reference Release 10.2

B14357-01

June 2005

SQL*Plus User's Guide and Reference, Release 10.2

B14357-01

Copyright ? 1996, 2005 Oracle. All rights reserved.

Primary Author: Simon Watt

Contributor: Alison Goggin, Alison Holloway, Anil Samuel, Christopher Jones, Luan Nim, Richard Rendell, Andrei Souleimanian.

The Programs (which include both the software and documentation) contain proprietary information; they are provided under a license agreement containing restrictions on use and disclosure and are also protected by copyright, patent, and other intellectual and industrial property laws. Reverse engineering, disassembly, or decompilation of the Programs, except to the extent required to obtain interoperability with other independently created software or as specified by law, is prohibited.

The information contained in this document is subject to change without notice. If you find any problems in the documentation, please report them to us in writing. This document is not warranted to be error-free. Except as may be expressly permitted in your license agreement for these Programs, no part of these Programs may be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose.

If the Programs are delivered to the United States Government or anyone licensing or using the Programs on behalf of the United States Government, the following notice is applicable:

U.S. GOVERNMENT RIGHTS Programs, software, databases, and related documentation and technical data delivered to U.S. Government customers are "commercial computer software" or "commercial technical data" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, use, duplication, disclosure, modification, and adaptation of the Programs, including documentation and technical data, shall be subject to the licensing restrictions set forth in the applicable Oracle license agreement, and, to the extent applicable, the additional rights set forth in FAR 52.227-19, Commercial Computer Software--Restricted Rights (June 1987). Oracle Corporation, 500 Oracle Parkway, Redwood City, CA 94065

The Programs are not intended for use in any nuclear, aviation, mass transit, medical, or other inherently dangerous applications. It shall be the licensee's responsibility to take all appropriate fail-safe, backup, redundancy and other measures to ensure the safe use of such applications if the Programs are used for such purposes, and we disclaim liability for any damages caused by such use of the Programs.

Oracle, JD Edwards, PeopleSoft, and Retek are registered trademarks of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

The Programs may provide links to Web sites and access to content, products, and services from third parties. Oracle is not responsible for the availability of, or any content provided on, third-party Web sites. You bear all risks associated with the use of such content. If you choose to purchase any products or services from a third party, the relationship is directly between you and the third party. Oracle is not responsible for: (a) the quality of third-party products or services; or (b) fulfilling any of the terms of the agreement with the third party, including delivery of products or services and warranty obligations related to purchased products or services. Oracle is not responsible for any loss or damage of any sort that you may incur from dealing with any third party.

Contents

Preface ............................................................................................................................................................... xiii

Audience..................................................................................................................................................... xiii Documentation Accessibility ................................................................................................................... xiii Related Documents ................................................................................................................................... xiv Conventions ............................................................................................................................................... xv

What's New in SQL*Plus?..................................................................................................................... xvii

New Features in SQL*Plus Release 10.2................................................................................................ xvii

SQL*Plus Quick Start .............................................................................................................................. xix

SQL*Plus Resources .................................................................................................................................. xix SQL*Plus Overview .................................................................................................................................. xix SQL*Plus Prerequisites ............................................................................................................................ xxii Starting SQL*Plus Command-line ......................................................................................................... xxii Starting SQL*Plus Windows GUI ......................................................................................................... xxiv Starting iSQL*Plus................................................................................................................................... xxiv Starting SQL*Plus Instant Client ........................................................................................................... xxv Connecting to a Different Database...................................................................................................... xxv Sample Schemas and SQL*Plus............................................................................................................. xxv Running your first Query....................................................................................................................... xxvi Exiting SQL*Plus .................................................................................................................................... xxvii

Part I SQL*Plus Getting Started

1 SQL*Plus User Interface

SQL*Plus Command-line User Interface............................................................................................. 1-1 The Command-line Screen................................................................................................................ 1-1 Changing the Command-line Font and Font Size ......................................................................... 1-1

Windows Graphical User Interface....................................................................................................... 1-2 Using the Mouse to Copy Text to the Command Prompt ........................................................... 1-3 Using Command Keys....................................................................................................................... 1-3 Using the Windows GUI Menus...................................................................................................... 1-3 Changing the Windows GUI Font and Font Size .......................................................................... 1-6

iSQL*Plus User Interface ........................................................................................................................ 1-7

iii

iSQL*Plus Navigation........................................................................................................................ 1-7 iSQL*Plus Login Screen..................................................................................................................... 1-8 iSQL*Plus DBA Login Screen ........................................................................................................... 1-9 iSQL*Plus Workspace..................................................................................................................... 1-11 iSQL*Plus DBA Workspace ........................................................................................................... 1-13 iSQL*Plus History Screen............................................................................................................... 1-13 iSQL*Plus Input Required Screen................................................................................................. 1-14 iSQL*Plus Preferences Screen........................................................................................................ 1-15 Preferences and Equivalent SET Commands .................................................................................. 1-18

2 Configuring SQL*Plus

SQL*Plus and iSQL*Plus Environment Variables............................................................................. 2-1 SQL*Plus and iSQL*Plus Configuration............................................................................................. 2-4

Site Profile ........................................................................................................................................... 2-5 User Profile.......................................................................................................................................... 2-5 Storing and Restoring SQL*Plus System Variables....................................................................... 2-6 Installing Command-line Help ........................................................................................................ 2-7 Configuring Oracle Net Services ..................................................................................................... 2-9 iSQL*Plus Application Server Configuration .................................................................................... 2-9 Changing the iSQL*Plus Application Server Port in Use............................................................. 2-9 Testing if the iSQL*Plus Application Server is Running ........................................................... 2-10 Setting the Level of iSQL*Plus Logging....................................................................................... 2-11 Setting the Session Time Out......................................................................................................... 2-11 Enabling Restricted Database Access ........................................................................................... 2-12 Enabling iSQL*Plus DBA Access .................................................................................................. 2-13 Enabling SSL with iSQL*Plus ........................................................................................................ 2-15 Enabling iSQL*Plus or iSQL*Plus Help ....................................................................................... 2-18 Enabling Unauthorised Access Banner........................................................................................ 2-18 Enabling URL Access...................................................................................................................... 2-19 Enabling User Defined HTML Markup ....................................................................................... 2-19 iSQL*Plus Web Browser Configuration ........................................................................................... 2-20 Session Integrity .............................................................................................................................. 2-20 Retained Session Settings............................................................................................................... 2-20 Windows Graphical User Interface Configuration......................................................................... 2-20 Setting Options and Values Using the Environment Dialog .................................................... 2-21 Customizing Registry Entries that affect SQL*Plus on Windows ........................................... 2-22

3 Starting SQL*Plus

Login Username and Password ............................................................................................................. 3-1 Secure External Password Store....................................................................................................... 3-2 Expired Password .............................................................................................................................. 3-2 Expired Password Screen in iSQL*Plus .......................................................................................... 3-2 Changing your Password ................................................................................................................. 3-3 Changing Your Password in iSQL*Plus.......................................................................................... 3-3

Connecting to a Database ....................................................................................................................... 3-4 Net Service Name............................................................................................................................... 3-4 Full Connection Identifier ................................................................................................................. 3-5

iv

Easy Connection Identifier ............................................................................................................... 3-5 Connectionless Session with /NOLOG .......................................................................................... 3-6 Starting SQL*Plus .................................................................................................................................... 3-6 Starting Command-line SQL*Plus ................................................................................................... 3-6 Getting Command-line Help ............................................................................................................ 3-7 Starting the Windows Graphical User Interface............................................................................ 3-7 Starting the iSQL*Plus Application Server..................................................................................... 3-8 To Check the HTTP Port used by the iSQL*Plus Application Server ........................................ 3-9 Stopping the iSQL*Plus Application Server................................................................................ 3-10 Starting iSQL*Plus........................................................................................................................... 3-10 Starting iSQL*Plus as a DBA ......................................................................................................... 3-10 Starting iSQL*Plus from a URL..................................................................................................... 3-11 Getting Help in iSQL*Plus ............................................................................................................. 3-12 Exiting SQL*Plus................................................................................................................................... 3-12 Exiting the Command-line User Interface ................................................................................... 3-13 Exiting the Windows Graphical User Interface .......................................................................... 3-13 Exiting the iSQL*Plus User Interface............................................................................................ 3-13 SQLPLUS Program Syntax .................................................................................................................. 3-13 Options ............................................................................................................................................. 3-14 Logon ................................................................................................................................................ 3-18 Start ................................................................................................................................................... 3-19

Part II Using SQL*Plus

4 SQL*Plus Basics

Entering and Executing Commands ..................................................................................................... 4-1 The SQL Buffer ................................................................................................................................... 4-2 Executing Commands ....................................................................................................................... 4-2

Listing a Table Definition....................................................................................................................... 4-3 Listing PL/SQL Definitions.................................................................................................................... 4-3 Running SQL Commands....................................................................................................................... 4-4

Understanding SQL Command Syntax .......................................................................................... 4-5 Running PL/SQL Blocks ......................................................................................................................... 4-6

Creating Stored Procedures .............................................................................................................. 4-6 Running SQL*Plus Commands............................................................................................................. 4-7

Understanding SQL*Plus Command Syntax ................................................................................. 4-8 System Variables that Affect How Commands Run.......................................................................... 4-8 Stopping a Command while it is Running ......................................................................................... 4-9 Running Operating System Commands.............................................................................................. 4-9 Pausing the Display .............................................................................................................................. 4-10 Saving Changes to the Database Automatically ............................................................................. 4-10 Interpreting Error Messages................................................................................................................ 4-11

5 Using Scripts in SQL*Plus

Editing Scripts........................................................................................................................................... 5-1 Writing Scripts with a System Editor.............................................................................................. 5-1

v

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download