O'Reilly logo

Oracle SQL*Plus: The Definitive Guide by Jonathan Gennick

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Executing the Statement in the Buffer

Once you get a statement into the buffer and have edited it the way you want it, the next step is to execute that statement. That can be done with one of the following two methods:

  1. Type a forward slash on a line by itself, then press ENTER.

  2. Use the RUN command, which may be abbreviated to R.

The only difference between using RUN and / is that the RUN command lists the contents of the buffer before executing it, while the / command simply executes the command without relisting it. Assume that you have the SQL statement shown next in the buffer, which you will if you have followed through all the examples in this chapter.

SQL> L
  1    SELECT employee_name,  project_name
  2      FROM employee, project, project_hours
  3     WHERE employee.employee_id = project_hours.employee_id
  4     AND project_hours.project_id = project.project_id
  5*    GROUP BY employee_name, project_name

Here is how you would run it using the / command:

SQL> /

EMPLOYEE_NAME                            PROJECT_NAME
---------------------------------------- ----------------------------------
Bohdan Khmelnytsky                       Accounting System Implementation
Bohdan Khmelnytsky                       Corporate Web Site
Bohdan Khmelnytsky                       Data Warehouse Maintenance
Bohdan Khmelnytsky                       TCP/IP Implementation
Bohdan Khmelnytsky                       Year 2000 Fixes
...

Now, here is how you would execute it using the RUN command, which in the following example is abbreviated to R:

SQL> R 1 SELECT employee_name, project_name 2 FROM employee, project, project_hours 3 WHERE employee.employee_id = ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required