Using SQLPlus


Using SQL*Plus

There are two versions of SQL*Plus: the Windows version and the command-line version. You may use the command-line version of SQL*Plus with any operating system on which the Oracle database runs. If you re at all familiar with the Oracle database, chances are that you re already familiar with SQL*Plus. If you re not, don t worry: you ll learn how to use SQL*Plus in this book.

In the next two sections, you ll learn how to start each version of SQL*Plus, beginning with the Windows version. After you ve learned how to start SQL*Plus, you ll see how to run a query against the database.

Starting the Windows Version of SQL*Plus

If you are using Windows, you may start SQL*Plus by clicking Start and selecting Programs Oracle Application Development SQL*Plus. Figure 1-1 shows the Log On dialog box for SQL*Plus running on Windows. Enter scott for the user name and tiger for the password (scott is an example user that is contained in most Oracle databases). The host string is used to tell SQL*Plus where the database is running. If you are running the database on your own computer, you ll typically leave the host string blank ”this causes SQL*Plus to attempt to connect to a database on the same machine on which SQL*Plus is running. If the database isn t running on your machine, you should speak with your database administrator (DBA). Click OK to continue.

click to expand
Figure 1-1: The SQL*Plus Log On dialog box
Note  

If you can t log on using scott and tiger, speak with your DBA. They ll be able to provide you with a user_name , password , and host_string for the purposes of this example.

After you ve clicked OK and successfully logged on to the database, you ll see the SQL*Plus window through which you can interact with the database. Figure 1-2 shows the SQL*Plus window.

click to expand
Figure 1-2: The SQL*Plus window

Starting the Command-Line Version of SQL*Plus

To start the command-line version of SQL*Plus, you may use the sqlplus command. The full syntax for the sqlplus command is

 sqlplus [  user_name  [/  password  [@  host_string  ]]] 

where

  • user_name specifies the name of the database user

  • password specifies the password for the database user

  • host_string specifies the database you want to connect to

The following are examples of issuing the sqlplus command:

 sqlplus scott/tiger sqlplus scott/tiger@orcl 
Note  

If you are using SQL*Plus with the Windows operating system, the Oracle installer automatically adds SQL*Plus to your path. If you are using a non-Windows operating system, you must either be in the same directory as the SQL*Plus program to run it or, better still, have added the program to your path . If you need help with that, talk to your system administrator.




Oracle Database 10g SQL
Oracle Database 10g SQL (Osborne ORACLE Press Series)
ISBN: 0072229810
EAN: 2147483647
Year: 2004
Pages: 217

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