0% found this document useful (0 votes)
40 views

Iniciando Con Oracle SQL Developer Part 1

This document provides an overview of getting started with Oracle SQL Developer. It introduces SQL Developer and its features, outlines prerequisites for using it, and provides step-by-step instructions for connecting to a database, creating and modifying tables, adding constraints and data to tables, running queries and reports, and developing PL/SQL code. The tutorial is designed to help users learn the basics of managing database objects using SQL Developer.

Uploaded by

Alcides Arbona
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views

Iniciando Con Oracle SQL Developer Part 1

This document provides an overview of getting started with Oracle SQL Developer. It introduces SQL Developer and its features, outlines prerequisites for using it, and provides step-by-step instructions for connecting to a database, creating and modifying tables, adding constraints and data to tables, running queries and reports, and developing PL/SQL code. The tutorial is designed to help users learn the basics of managing database objects using SQL Developer.

Uploaded by

Alcides Arbona
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Getting Started With Oracle SQL Developer http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/sqldev/r3...

Getting Started with Oracle SQL Developer 3.0


This tutorial contains the following sections:

Purpose
Time to Complete
Overview
Prerequisites
Creating a Database Connection
Adding a New Table Using the Create Table Dialog Box
Changing a Table Definition
Adding Table Constraints
Adding Data to a Table
Accessing Data
Creating Reports
Creating and Executing PL/SQL
Summary

Purpose
This tutorial introduces Oracle SQL Developer 3.0 and shows you how to manage your database objects.

Time to Complete
Approximately 50 minutes

Overview
Oracle SQL Developer is a free graphical tool that enhances productivity and simplifies database development tasks. Using SQL
Developer, you can browse database objects, run SQL statements, edit and debug PL/SQL statements and run reports, whether
provided or created.

Developed in Java, SQL Developer runs on Windows, Linux and the Mac OS X. This is a great advantage to the increasing
number of developers using alternative platforms. Multiple platform support also means that users can install SQL Developer on
the Database Server and connect remotely from their desktops, thus avoiding client server network traffic.

Default connectivity to the database is through the JDBC Thin driver, so no Oracle Home is required. To install SQL Developer
simply unzip the downloaded file. With SQL Developer you can connect to any supported Oracle Database.

Prerequisites
Before starting this tutorial, you should:

1 . Install Oracle SQL Developer 3.0 from OTN. Follow the readme instructions here.

2 . Install Oracle Database 11g with the Sample schema.

3. Unlock the HR user. Login to SQL Developer as the SYS user and execute the following command:
alter user hr identified by hr account unlock;

Note: This tutorial is developed using Oracle SQL Developer 3.0.

4 . Download and unzip the files.zip to a local folder on your file system. In this tutorial, we use the C:\sqldev3.0 folder.

Creating a Database Connection

1 de 13 25/04/2013 04:40 p.m.


Getting Started With Oracle SQL Developer http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/sqldev/r3...

The first step to managing database objects using Oracle SQL Developer 3.0 is to create a database connection. Perform the
following steps:

1 . If you installed the SQL Developer icon on your desktop, click the icon to start your SQL Developer and move to Step
4. If you do not have the icon located on your desktop, perform the following steps to create a shortcut to launch SQL
Developer 3.0 directly from your desktop.

Open the directory where the SQL Developer 3.0 is located, right-click sqldeveloper.exe (on Windows) or
sqldeveloper.sh (on Linux) and select Send to > Desktop (create shortcut).

2 . On the desktop, you will find an icon named Shortcut to sqldeveloper.exe. Double-click the icon to open SQL
Developer 3.0.

Note: To rename it, select the icon and then press F2 and enter a new name.

3 . Your Oracle SQL Developer opens.

4 . In the Connections navigator, right-click Connections and select New Connection.

5 . The New / Select Database Connection dialog opens. Enter the connection details as follows and click Test.

Connection Name: HR_ORCL


User Name: hr
Password: <your_password> (Select the Save Password checkbox)
Hostname: localhost
SID: <your_own_SID>

6 . Check for the status of the connection on the left-bottom side (above the Help button). It should read Success. Click
Connect. Then click Save.

7 . The connection was saved and you see the newly created connection in the Connections list.

2 de 13 25/04/2013 04:40 p.m.


Getting Started With Oracle SQL Developer http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/sqldev/r3...

8 . Expand HR_ORCL.

Note: When a connection is opened, a SQL Worksheet is opened automatically. The SQL Worksheet allows you to
execute SQL against the connection you have opened.

9 . Expand Tables.

10 . Select the EMPLOYEES table to view the table definition. Then click the Data tab.

11 . The data in the table is shown. In the next topic, you create a new table and populate the table with data.

12 . Click the DEPARTMENTS table in the Connections navigator.

13 . There are a number of constraints for the DEPARTMENTS table. To view the various constraints on the table, click
the Constraints tab.

14 . Note that the DEPARTMENTS table has 4 constraints. Each constraint has a unique name. The
CONSTRAINT_TYPE identifies the type of constraint on the table.

Click Edit .

15 . The Edit Table dialog has a number of fields. Select Foreign Keys beneath the Search field.

3 de 13 25/04/2013 04:40 p.m.


Getting Started With Oracle SQL Developer http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/sqldev/r3...

16 . Review the Foreign Keys constraints. Note that the DEPARTMENTS table has two foreign keys, one named
DEPT_LOC_FK and the other named DEPT_MGR_FK. When you select one of the names in the Foreign Keys field,
the details about that foreign key appear.

Click OK to leave the Edit Table dialog.

Adding a New Table Using the Create Table Dialog Box


In this section, you create a new table called DEPENDENTS. You create columns in the DEPENDENTS table. Your table will
have the columns ID, FIRST_NAME, LAST_NAME, BIRTHDATE, and RELATION.

Later, you create a foreign key on the DEPENDENTS table to associate the column's values with the EMPLOYEES table.
Perform the following steps:

1 . Right-click Tables and select New TABLE...

2 . Enter DEPENDENTS for the Table Name and select the Advanced check box.

3 . For the first column in your table, enter ID for the Name, select NUMBER for the Datatype and enter 6 for the
Precision (length of the number). Select Cannot be NULL, then click Add Column .

Note: By checking Cannot be NULL, you are adding a constraint on the table that specifies the column must hold
values.

4 . For the next column, enter FIRST_NAME for the Name, leave the type as VARCHAR2 and enter 20 for the Size to
specify the length of the VARCHAR2. Then click Add Column .

5 . For the next column, enter LAST_NAME for the Name, leave the type as VARCHAR2 and enter 25 for the Size.
Select the Cannot be NULL check box. Then click Add Column .

4 de 13 25/04/2013 04:40 p.m.


Getting Started With Oracle SQL Developer http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/sqldev/r3...

6 . For the next column, enter BIRTHDATE for the Name, select DATE for the type. Then click Add Column .

7 . For the last column, enter RELATION for the Name, leave type as VARCHAR2 and enter 25 for the Size. Click OK to
create the table.

8 . Your new table appears in the list of tables.

Changing a Table Definition


Oracle SQL Developer makes it very easy to make changes to database objects. In this topic, you add a column called
RELATIVE_ID to the DEPENDENTS table you just created. Perform the following steps:

1 . In the Connections navigator, select the DEPENDENTS table.

2 . Right-click, select Column then Add...

3 . Enter RELATIVE_ID, select NUMBER for the Data Type (from the drop list), set the Precision to 6 and Scale to 0.

Click Apply.

Note: If you want to see the SQL that is generated for you, click the SQL tab.

4 . The confirmation verifies that a column has been added.

Click OK.

5 de 13 25/04/2013 04:40 p.m.

You might also like