Sei sulla pagina 1di 28

Using SQL Developer

Copyright 2007, 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 the SQL Worksheet Execute SQL statements and SQL scripts Edit and debug PL/SQL statements Create and save reports

C-2

Copyright 2007, Oracle. All rights reserved.

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 2007, Oracle. All rights reserved.

Key Features
Developed in Java Supports Windows, Linux, and Mac OS X platforms Default connectivity by using the JDBC Thin driver Does not require an installer Connects to any Oracle Database version 9.2.0.1 and later Bundled with JRE 1.5

C-4

Copyright 2007, Oracle. All rights reserved.

Installing SQL Developer


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

C-5

Copyright 2007, Oracle. All rights reserved.

Menus for SQL Developer

2 1 3

4 5

C-6

Copyright 2007, 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 any connections defined in the tnsnames.ora file on your system. You can export connections to an XML file. Each additional database connection created is listed in the Connections Navigator hierarchy.

C-7

Copyright 2007, Oracle. All rights reserved.

Creating a Database Connection

C-8

Copyright 2007, Oracle. All rights reserved.

Browsing Database Objects


Use the Database Navigator to: Browse through many objects in a database schema Review the definitions of objects at a glance

C-9

Copyright 2007, Oracle. All rights reserved.

Creating a Schema Object


SQL Developer supports the creation of any schema object by:
Executing a SQL statement in the SQL Worksheet Using the shortcut menu

Edit the objects using an edit dialog box 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 - 10

Copyright 2007, Oracle. All rights reserved.

Creating a New Table: Example

C - 11

Copyright 2007, Oracle. All rights reserved.

Using the SQL Worksheet


Use the SQL Worksheet to enter and execute SQL, PL/SQL, and SQL*Plus statements. Specify any actions that can be processed by the database connection associated with the worksheet.

C - 12

Copyright 2007, Oracle. All rights reserved.

Using the SQL Worksheet


2 4 6

1 3

C - 13

Copyright 2007, Oracle. All rights reserved.

Executing SQL Statements


Use the Enter SQL Statement box to enter single or multiple SQL statements.

C - 14

Copyright 2007, Oracle. All rights reserved.

Viewing the Execution Plan

C - 15

Copyright 2007, Oracle. All rights reserved.

Formatting the SQL Code


Before formatting

After formatting

C - 16

Copyright 2007, Oracle. All rights reserved.

Using Snippets
Snippets are code fragments that may be syntax or examples.

C - 17

Copyright 2007, Oracle. All rights reserved.

Using Snippets: Example

Inserting a snippet

Editing the snippet

C - 18

Copyright 2007, Oracle. All rights reserved.

Using SQL*Plus
The SQL Worksheet does not support all SQL*Plus statements. You can invoke the SQL*Plus command-line interface from SQL Developer.

C - 19

Copyright 2007, Oracle. All rights reserved.

Creating an Anonymous Block


Create an anonymous block and display the output of the DBMS_OUTPUT package statements.

C - 20

Copyright 2007, Oracle. All rights reserved.

Editing the PL/SQL Code


Use the full-featured editor for PL/SQL program units.

C - 21

Copyright 2007, Oracle. All rights reserved.

Creating a PL/SQL Procedure

2
C - 22

Copyright 2007, Oracle. All rights reserved.

Compiling a PL/SQL Procedure

C - 23

Copyright 2007, Oracle. All rights reserved.

Running a PL/SQL Procedure

C - 24

Copyright 2007, Oracle. All rights reserved.

Debugging PL/SQL

C - 25

Copyright 2007, Oracle. All rights reserved.

Database Reporting
SQL Developer provides several predefined reports about the database and its objects.

C - 26

Copyright 2007, Oracle. All rights reserved.

Creating a User-Defined Report


Create and save user-defined reports for repeated use.

C - 27

Copyright 2007, 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 the SQL Worksheet Edit and debug PL/SQL statements Create and save custom reports

C - 28

Copyright 2007, Oracle. All rights reserved.

Potrebbero piacerti anche