The SQL Buffer

SQL*Plus keeps a copy of the most recently entered SQL statement or PL/SQL block in an internal memory area known as the SQL buffer , often referred to as the buffer . Command-line SQL*Plus needs a place to store your statement or block until you are finished entering it. SQL*Plus provides you with the ability to edit the statement in the buffer. This can be a real convenience if you make a mistake halfway through typing a long, multiline query.

SQL*Plus buffers SQL statements and PL/SQL blocks, but not SQL*Plus commands. For example, the DESCRIBE command would not be buffered but a SELECT statement would be. To help make the distinction, think in terms of where the command is executed. If you enter something to be executed by the database server, then it is buffered. If it's a command local to SQL*Plus, then it is not buffered.

SQL*Plus provides two ways to edit the statement currently in the buffer. The first method is to use the set of line-editing commands built into SQL*Plus. The second method is to use the EDIT command to invoke an operating system-specific text editor, such as Notepad in the Windows environment, or vi under Unix.

If you are editing a statement in the buffer, be sure you don't forget yourself and execute any other SQL statement. Even a simple SQL statement like COMMIT will overwrite the buffer. Commands to SQL*Plus, such as the editing commands, do not affect the buffer.

 

There are some other useful things you can do with the buffer. If you have several similar SQL statements to execute, using the buffer can save you the effort of completely typing out each one. You may be able to enter the first statement, execute it, make a minor change, execute the new statement, and so on, until you are done. SQL*Plus also allows you to save and load the buffer to and from a text file, allowing you to store frequently executed statements for later use.

     

Introduction to SQL*Plus

Command-Line SQL*Plus

Browser-Based SQL*Plus

A Lightning SQL Tutorial

Generating Reports with SQL*Plus

Creating HTML Reports

Advanced Reports

Writing SQL*Plus Scripts

Extracting and Loading Data

Exploring Your Database

Advanced Scripting

Tuning and Timing

The Product User Profile

Customizing Your SQL*Plus Environment

Appendix A. SQL*Plus Command Reference

Appendix B. SQL*Plus Format Elements



Oracle SQL Plus The Definitive Guide, 2nd Edition
Oracle SQL*Plus: The Definitive Guide (Definitive Guides)
ISBN: 0596007469
EAN: 2147483647
Year: N/A
Pages: 151

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net