O'Reilly logo

Oracle SQL*Plus: The Definitive Guide, 2nd Edition 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. You can do that using one of the following two methods:

  • Type a forward slash on a line by itself, then press Enter.

  • Use the RUN command, which you may abbreviate to R.

The only difference between using / and RUN is that the RUN command lists the contents of the buffer before executing it, and the / command simply executes the command without re-listing 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 JOIN project_hours
  3          ON employee.employee_id = project_hours.employee_id
  4  JOIN project
  5          ON project_hours.project_id = project.project_id
  6* GROUP BY employee_name, project_name

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

SQL> /

EMPLOYEE_NAME                  PROJECT_NAME
------------------------------ ----------------------------------------
Ivan Mazepa                    Corporate Web Site
Ivan Mazepa                    VPN Implementation
Ivan Mazepa                    Data Warehouse Maintenance
...

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 JOIN project_hours 3 ON employee.employee_id = project_hours.employee_id 4 JOIN project 5 ON project_hours.project_id = project.project_id 6* GROUP BY employee_name, project_name ...

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