0% found this document useful (0 votes)
62 views29 pages

Chapter 2

Uploaded by

Eckart Schneider
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views29 pages

Chapter 2

Uploaded by

Eckart Schneider
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 29

Chapter 2

How to use
Oracle SQL Developer
and other tools

Murach’s Oracle SQL and


PL/SQL, C2 © 2014, Mike Murach & Associates, Inc. Slide 1
Objectives
Applied
 Start or stop the Oracle database server and listener.
 Use SQL*Plus to run a SQL statement.
 Use Oracle SQL Developer to do any of the following:
Create a database connection
Export or import database connections
Navigate through the objects of a database
View the column definitions for a table
View the data for a table
Edit the column definitions for a table
 Use Oracle SQL Developer to enter, run, open, and save SQL
statements and scripts.
 Use the SQL Reference manual to look up information about SQL
statements.

Murach’s Oracle SQL and


PL/SQL, C2 © 2014, Mike Murach & Associates, Inc. Slide 2
Objectives (continued)
Knowledge
 Briefly describe the function of each of these products:
Database Home Page
SQL*Plus
Oracle SQL Developer
SQL Reference manual

Murach’s Oracle SQL and


PL/SQL, C2 © 2014, Mike Murach & Associates, Inc. Slide 3
How to stop the database
 StartAll Programs
Oracle Database 11g Express Edition
Stop Database

The DOS window when the database is stopped

Murach’s Oracle SQL and


PL/SQL, C2 © 2014, Mike Murach & Associates, Inc. Slide 4
How to start the database
 StartAll Programs
Oracle Database 11g Express Edition
Start Database

The DOS window when the database is started

Murach’s Oracle SQL and


PL/SQL, C2 © 2014, Mike Murach & Associates, Inc. Slide 5
Terms to know
 Database service (database server, database engine)
 Database listener

Murach’s Oracle SQL and


PL/SQL, C2 © 2014, Mike Murach & Associates, Inc. Slide 6
The Database Home Page

Murach’s Oracle SQL and


PL/SQL, C2 © 2014, Mike Murach & Associates, Inc. Slide 7
How to start the Database Home Page from the
Windows Start menu
 All Programs
Oracle Database 11g Express EditionGet Started

 Use the Application Express tab to log in.

How to use the Database Home Page to create a


user for a database
 Log in as the system user.
 Use the resulting web page to create the user.

Murach’s Oracle SQL and


PL/SQL, C2 © 2014, Mike Murach & Associates, Inc. Slide 8
The SQL*Plus tool

Murach’s Oracle SQL and


PL/SQL, C2 © 2014, Mike Murach & Associates, Inc. Slide 9
How to start SQL*Plus
 Find the sqlplus.exe file and run it.

How to connect to a database with SQL*Plus


 Enter the username and password.

How to run a SQL statement with SQL*Plus


 Type the statement.
 Type a semicolon, and press the Enter key.

Murach’s Oracle SQL and


PL/SQL, C2 © 2014, Mike Murach & Associates, Inc. Slide 10
The SQL Developer dialog box for creating
database connections

Murach’s Oracle SQL and


PL/SQL, C2 © 2014, Mike Murach & Associates, Inc. Slide 11
How to create a database connection
 Right-click on the Connections node.
 Select the New Connection command.
 Enter a connection name, username, and password.
 Click the Test button to test the connection.
 Click the Save button to save the connection.

Murach’s Oracle SQL and


PL/SQL, C2 © 2014, Mike Murach & Associates, Inc. Slide 12
How to export database connections
 Right-click the Connections node.
 Select the Export Connections command.
 Select the connections that you want to export.
 Specify the path and filename for the XML file for the connections.

How to import database connections


 Right-click the Connections node.
 Select the Import Connections command.
 Navigate to the XML file for the connections.
 Select the connections that you want to import.

Murach’s Oracle SQL and


PL/SQL, C2 © 2014, Mike Murach & Associates, Inc. Slide 13
The Connection Information dialog box

Murach’s Oracle SQL and


PL/SQL, C2 © 2014, Mike Murach & Associates, Inc. Slide 14
The tables available to the AP user

Murach’s Oracle SQL and


PL/SQL, C2 © 2014, Mike Murach & Associates, Inc. Slide 15
The column definitions for a table

Murach’s Oracle SQL and


PL/SQL, C2 © 2014, Mike Murach & Associates, Inc. Slide 16
How to view the column definitions for a table
 Click on the name of the table in the Connections window.
 By default, the columns are displayed in the sequence in which
they were created.

How to view the data for a table


 Click on the Data tab.

Murach’s Oracle SQL and


PL/SQL, C2 © 2014, Mike Murach & Associates, Inc. Slide 17
Editing the column definition of a table

Murach’s Oracle SQL and


PL/SQL, C2 © 2014, Mike Murach & Associates, Inc. Slide 18
A SELECT statement and its results

Murach’s Oracle SQL and


PL/SQL, C2 © 2014, Mike Murach & Associates, Inc. Slide 19
How to change the connection for a worksheet
 Use the Connections list

How to comment out or uncomment a line


 Press Ctrl+/.

Two ways to execute a SQL statement


 Press the F9 key.
 Click the Execute Statement button in the toolbar.

Murach’s Oracle SQL and


PL/SQL, C2 © 2014, Mike Murach & Associates, Inc. Slide 20
Using the snippets window

Murach’s Oracle SQL and


PL/SQL, C2 © 2014, Mike Murach & Associates, Inc. Slide 21
Handling syntax errors

Murach’s Oracle SQL and


PL/SQL, C2 © 2014, Mike Murach & Associates, Inc. Slide 22
Common causes of errors
 Misspelling the name of a table or column
 Misspelling a keyword
 Omitting the closing quotation mark
 Being connected as the wrong user

Murach’s Oracle SQL and


PL/SQL, C2 © 2014, Mike Murach & Associates, Inc. Slide 23
The Open File dialog box

Murach’s Oracle SQL and


PL/SQL, C2 © 2014, Mike Murach & Associates, Inc. Slide 24
Three ways to open a SQL file
 Click the Open button in the toolbar.
 Press Ctrl+O.
 Select the FileOpen command.

How to switch between open statements


 Select the appropriate tab.

How to cut, copy, and paste code


 Use the standard Windows techniques.

Murach’s Oracle SQL and


PL/SQL, C2 © 2014, Mike Murach & Associates, Inc. Slide 25
Three ways to save a SQL file
 Click the Save button in the toolbar.
 Press Ctrl+S.
 Select the FileSave command.

How to change the default directory


for new statements
 Use the ToolsPreferences command.
 Expand the Database node.
 Click on the Worksheet Parameters node.
 Change the default path for scripts.

Murach’s Oracle SQL and


PL/SQL, C2 © 2014, Mike Murach & Associates, Inc. Slide 26
A SQL script and its results

Murach’s Oracle SQL and


PL/SQL, C2 © 2014, Mike Murach & Associates, Inc. Slide 27
How to run an entire SQL script
 Press F5 or click the Run Script button.

How to run one statement within a script


1. Move the cursor into the statement you want to execute.
2. Press F9 or click the Execute Statement button.

Note
 The results of a statement are displayed in the Results tab.
 The results of a script are displayed in the Script Output tab.

Murach’s Oracle SQL and


PL/SQL, C2 © 2014, Mike Murach & Associates, Inc. Slide 28
The Oracle Database SQL Reference manual

Murach’s Oracle SQL and


PL/SQL, C2 © 2014, Mike Murach & Associates, Inc. Slide 29

You might also like