Using SQL Developer

Download as pdf or txt
Download as pdf or txt
You are on page 1of 26

Using SQL Developer

Copyright © 2008, Oracle. All rights reserved.


Objectives

After completing this appendix, you should be able to do the


following:
• List the key features of Oracle SQL Developer
• Install Oracle SQL Developer
• Identify menu items of Oracle SQL Developer
• Create a database connection
• Manage database objects
• Use SQL worksheet
• Save and run SQL scripts
• Create and save reports

C-2 Copyright © 2008, Oracle. All rights reserved.


What Is Oracle SQL Developer?

• Oracle SQL Developer is a graphical tool that enhances


productivity and simplifies database development tasks.
• You can connect to any target Oracle database schema by
using standard Oracle database authentication.

SQL Developer

C-3 Copyright © 2008, Oracle. All rights reserved.


Specifications of SQL Developer

• Developed in Java
• Supports Windows, Linux, and Mac OS X platforms
• Default connectivity by using the JDBC Thin driver
• Does not require an installer
– Unzip the downloaded SQL Developer kit and double-click
sqldeveloper.exe to start SQL Developer.
• Connects to any Oracle Database version 9.2.0.1 and later
• Freely downloadable from the following link:
– http://www.oracle.com/technology/software/products/sql/
index.html
• Needs JDK 1.5 to be installed on your system. It can be
downloaded from the following link:
– http://java.sun.com/javase/downloads/index_jdk5.jsp

C-4 Copyright © 2008, Oracle. All rights reserved.


Installing SQL Developer

Download the Oracle SQL Developer kit and unzip into any
directory on your machine.

C-5 Copyright © 2008, Oracle. All rights reserved.


SQL Developer Interface

You must define a


connection to start
using SQL Developer
for running SQL queries
on a database schema.

C-6 Copyright © 2008, Oracle. All rights reserved.


Creating a Database Connection

• You must have at least one database connection to use SQL


Developer.
• You can create and test connections:
– For multiple databases
– For multiple schemas
• SQL Developer automatically imports connections defined in
the tnsnames.ora file on your system.
• You can export connections to an XML file.
• Each additional database connection that is created is listed
in the Connections navigator hierarchy.

C-7 Copyright © 2008, Oracle. All rights reserved.


Creating a Database Connection

C-8 Copyright © 2008, Oracle. All rights reserved.


Browsing Database Objects

Use the Connections navigator to:


• Browse through many objects in a database schema
• Review the definitions of objects at a glance

C - 10 Copyright © 2008, Oracle. All rights reserved.


Creating a Schema Object

• SQL Developer supports the creation of any schema object


by:
– Executing a SQL statement in SQL worksheet
– Using the context menu
• Edit the objects by using an edit dialog or one of the many
context-sensitive menus.
• View the DDL for adjustments, such as creating a new object
or editing an existing schema object.

C - 11 Copyright © 2008, Oracle. All rights reserved.


Creating a Table: Example

C - 12 Copyright © 2008, Oracle. All rights reserved.


Using the SQL Worksheet

• Use the SQL worksheet to enter and execute SQL, PL/SQL,


and SQL*Plus statements.
• Specify actions that can be processed by the database
connection associated with the worksheet.

Enter SQL
statements.

Results are
shown here.

C - 13 Copyright © 2008, Oracle. All rights reserved.


Using the SQL Worksheet

1 2 4 6 8 9

5 7
3

C - 14 Copyright © 2008, Oracle. All rights reserved.


Executing SQL Statements

Use the Enter SQL Statement box to enter single or multiple


SQL statements.

F9 F5

F5
F9

C - 16 Copyright © 2008, Oracle. All rights reserved.


Formatting the SQL Code

Before
formatting

After
formatting

C - 17 Copyright © 2008, Oracle. All rights reserved.


Saving SQL Statements

2
3

C - 18 Copyright © 2008, Oracle. All rights reserved.


Running Script Files

C - 19 Copyright © 2008, Oracle. All rights reserved.


Using Snippets

Snippets are code fragments that may be just syntax or


examples.
When you place your cursor here,
it shows the Snippets window.
From the drop-down list, you can
select the functions category.

C - 20 Copyright © 2008, Oracle. All rights reserved.


Using Snippets: Example

Inserting a
snippet

Editing the
snippet

C - 21 Copyright © 2008, Oracle. All rights reserved.


Using SQL*Plus

• You can invoke the SQL*Plus command-line interface from


SQL Developer.
• Close all SQL worksheets to enable the SQL*Plus menu
option.

Provide the
location of the
sqlplus.exe
file only the
first time you
invoke
SQL*Plus.

C - 22 Copyright © 2008, Oracle. All rights reserved.


Debugging Procedures and Functions

• Use SQL Developer to debug PL/SQL functions and


procedures.
• Use the Compile for Debug option to perform a PL/SQL
compilation so that the procedure can be debugged.
• Use the Debug menu options to set breakpoints and to
perform step into, step
over tasks.

C - 23 Copyright © 2008, Oracle. All rights reserved.


Database Reporting

SQL Developer provides a number of predefined reports about


the database and its objects.

C - 24 Copyright © 2008, Oracle. All rights reserved.


Creating a User-Defined Report

Create and save user-defined reports for repeated use.

Organize reports in folders

C - 25 Copyright © 2008, Oracle. All rights reserved.


Search Engines and External Tools

Shortcuts to
frequently used tools
1

Links to popular
search engines and
discussion forums

C - 26 Copyright © 2008, Oracle. All rights reserved.


Setting Preferences

• Customize the SQL Developer interface and environment.


• From the Tools menu, select Preferences.

C - 27 Copyright © 2008, Oracle. All rights reserved.


Summary

In this appendix, you should have learned how to use SQL


Developer to do the following:
• Browse, create, and edit database objects
• Execute SQL statements and scripts in SQL worksheet
• Create and save custom reports

C - 28 Copyright © 2008, Oracle. All rights reserved.

You might also like