Database Articles

  Home arrow Database Articles arrow Using SQL Plus with Oracle
DATABASE ARTICLES

Using SQL Plus with Oracle
By: Murach Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2011-05-25

    Table of Contents:
  • Using SQL Plus with Oracle
  • How to use SQL Developer to work with a database

  •  
     

    SEARCH CODEWALKERS

    TOOLS YOU CAN USE

    advertisement

    Using SQL Plus with Oracle


    (Page 1 of 2 )

    In this second part of a seven-part article series, you'll learn how to use SQL*Plus, a command line tool, to work with the Oracle SQL database. While newer tools are easier to use, this one has been around for a long time, and many developers still use it. This article is excerpted from chapter two of the book Murach's Oracle SQL and PL/SQL, written by Joel Murach (Murach; ISBN: 1890774502).

    How to use SQL Plus

    Figure 2-3 shows how to use a command-line tool known as SQL*Plus to work with the database. The SQL*Plus tool has been around since the earliest days of the Oracle database, and many Oracle developers still use it. However, the newer SQL Developer tool described later in this chapter is easier to learn and use than the SQL*Plus tool. That’s why this chapter and the rest of this book shows how to work with the SQL Developer tool.

    Still, there may be times when it makes sense to use SQL*Plus. If, for example, you are working on a computer that has SQL*Plus installed but doesn’t have SQL Developer installed, you may need to use SQL*Plus to run some SQL statements. Or, you may need to develop a batch file that uses SQL*Plus to run one or more SQL scripts. Figure A-5 of appendix A, for example, shows how to run a batch file that starts SQL*Plus and uses it to run four SQL scripts. In that case, of course, it makes sense to use SQL*Plus.

    If you need to start SQL*Plus, you can do that by selecting the Run command from the Start menu, entering “sqlplus”, and selecting the OK button. Then, you can connect to the database as a user by entering the username and password. In this figure, for example, I started by connecting as the AP user.

    Once you’re connected to the database, you can run SQL statements. To do that, you type the SQL statement followed by a semicolon and press the Enter key. Then, if the statement selects data, SQL*Plus will display the data. In this figure, for example, I entered a SQL statement that displays the vendor_name for the vendor with an id of 11.

    At any time, you can connect to the database as a different user by entering the CONNECT command. When you enter this command, SQL*Plus prompts you for a username and password. In this figure, for example, I entered the CONNECT command to connect as the OM user.

    The SQL*Plus tool

    Description

    1. SQL*Plus is a command-line tool that’s installed with the Oracle Database. You can use it to work with an Oracle Database.
    2. To start SQL*Plus, select the Run command from the Start menu, enter “sqlplus”, and select the OK button.
    3. To connect to a database, enter the username and password. If necessary, you can enter the CONNECT command to have SQL*Plus prompt you for a username and password.
    4. To run a SQL statement, type it, type a semicolon, and press the Enter key.
    5. For most tasks, it’s easier to use the SQL Developer tool that’s described later in this chapter.

    --------------------------------------------Figure 2-3 How to use SQL*Plus

    More Database Articles Articles
    More By Murach Publishing

    blog comments powered by Disqus

    DATABASE ARTICLES ARTICLES

    - MariaDB, a MySQL Alternative, Opens Foundati...
    - Oracle Supporting HP Itanium Again, Finally
    - Completing a Book Inventory Management System
    - Uploading Images for a Book Inventory Manage...
    - Finishing the Add Book Story for a Book Inve...
    - Integration Testing for a Book Inventory Man...
    - User Stories for a Book Inventory Management...
    - Unit Testing a Book Inventory Management Sys...
    - Testing a Book Inventory Management System
    - Implementing Models for a Book Inventory Man...
    - Book Inventory Application: Publishers and B...
    - Handling Publishers in a Book Inventory Mana...
    - Publisher Administration for Book Inventory ...
    - Book Inventory Management
    - Using the SQL Reference Manual

    Developer Shed Affiliates

     



    © 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap