Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 30

1

Introduction

Copyright © 2008, Oracle. All rights reserved.


Course Objectives

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


following:
• Design PL/SQL packages and program units that execute
efficiently
• Write code to interface with external applications and the
operating system
• Create PL/SQL applications that use collections
• Write and tune PL/SQL code effectively to maximize
performance
• Implement a virtual private database with fine-grained
access control
• Write code to interface with large objects and use SecureFile
LOBs
• Perform code analysis to find program ambiguities, test,
trace, and profile PL/SQL code
1-2 Copyright © 2008, Oracle. All rights reserved.
Oracle Complete Solution

Clients

Any Any Any


browser mail client FTP client

Development tools
Internet applications
System management

SQL

Business logic Presentation and


and data business logic PL/SQL

Databases Application Other


servers
Java
Network services

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


Lesson Agenda

• Previewing the course agenda


• Describing the development environments
• Using SQL Developer
• Using SQL*Plus
• Identifying the tables, data, and tools used in this course

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


Course Agenda

• Day 1
– Lesson 1: Introduction
– Lesson 2: PL/SQL Review
– Lesson 3: Designing PL/SQL Code
– Lesson 4: Working with Collections
• Day 2
– Lesson 4: Working with Collections
– Lesson 5: Using Advanced Interface Methods
– Lesson 6: Implementing Fine-Grained Access Control for VPD
– Lesson 7: Manipulating Large Objects
– Lesson 8: Administering SecureFile LOBs
– Lesson 9: Performance and Tuning

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


Course Agenda

• Day 3
– Lesson 10: Improving Performance with Caching
– Lesson 11: Analyzing PL/SQL Code
– Lesson 12: Profiling and Tracing PL/SQL Code
– Lesson 13: Safeguarding Your Code Against SQL Injection
Attacks

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


Lesson Agenda

• Previewing the course agenda


• Describing the development environments
• Using SQL Developer
• Using SQL*Plus
• Identifying the tables, data, and tools used in this course

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


Development Environments: Overview

• Introduction to SQL Developer


• SQL*Plus

SQL Developer

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


Lesson Agenda

• Previewing the course agenda


• Describing the development environments
• Using SQL Developer
• Using SQL*Plus
• Identifying the tables, data, and tools used in this course

1-9 Copyright © 2008, Oracle. All rights reserved.


What Is Oracle SQL Developer?

• Oracle SQL Developer is a free graphical tool that enhances


productivity and simplifies database development tasks.
• You can connect to any target Oracle database schema by
using the standard Oracle database authentication.
• You can use either SQL Developer or SQL*Plus in this
course.

SQL Developer

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


Starting SQL Developer and
Creating a Database Connection
1
3

4 5

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


Creating Schema Objects

• You can create any schema object in SQL Developer by


using one of the following methods:
– Executing a SQL statement in the SQL worksheet
– Using the context menu
• Edit the objects by 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

1 - 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 any actions that can be processed by the database
connection associated with the worksheet.

Click the Open SQL


Worksheet icon.

Select SQL
Worksheet from the
Tools menu, or

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


Using the SQL Worksheet

2 4 6 8

1 3 5 7 9

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


Executing SQL Statements

Use the Enter SQL Statement box to enter single or multiple


SQL statements.

Use the Enter SQL


Statement box to
enter single or
multiple SQL
statements.

View the results on


the Script Output
tabbed page.

1 - 15 Copyright © 2008, Oracle. All rights reserved.


Executing Saved Script Files: Method 1

Right-click in the SQL


worksheet area, and then
select Open File from the
shortcut menu.

To run the code, click


the Run Script (F5)
icon.
Select (or navigate
to) the script file that
you want to open.
Click Open.

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


Executing Saved SQL Scripts: Method 2

Use the @ command followed by the location


and name of the file that you want to
execute, and then click the Run Script icon.

The output from the


script is displayed on
the Script Output
tabbed page.

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


Creating an Anonymous Block

Create an anonymous block and display the output of the


DBMS_OUTPUT package.

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


Editing the PL/SQL Code

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

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


Saving SQL Scripts

Click the Save icon to Enter a file name and


save your SQL identify a location to
statement to a file. save the file in, and
then click Save.

The contents of the


saved file are visible
and editable in your
SQL worksheet
window.

1 - 20 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 and step
over tasks.

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


Lesson Agenda

• Previewing the course agenda


• Describing the development environments
• Using SQL Developer
• Using SQL*Plus
• Identifying the tables, data, and tools used in this course

1 - 22 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 for
the first time
you invoke
SQL*Plus.

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


Coding PL/SQL in SQL*Plus

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


Lesson Agenda

• Previewing the course agenda


• Describing the development environments
• Using SQL Developer
• Using SQL*Plus
• Identifying the tables, data, and tools used in this course

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


Tables Used in This Course

• The sample schemas used are:


– Order Entry (OE) schema
– Human Resources (HR) schema
• Primarily, the OE schema is used.
• The OE schema user can read data in the HR schema tables.
• Appendix B contains more information about the sample
schemas.

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


The Order Entry Schema
PROMOTIONS CUSTOMERS
promo_id customer_id
promo_name customer_first_name
OE customer_last_name
cust_address_typ

ORDERS street_address
order_id postal_code
ORDER_ITEMS city
order_date
order_id state_province
order_mode
line_item_id country_id
customer_id
product_id
order_status
unit_price phone_numbers
order_total
quantity nls_language
sales_rep_id
promotion_id nls_territory
credit_limit
cust_email
CATEGORIES_ PRODUCT_ PRODUCT_ account_mgr_id
TAB INFORMATION DESCRIPTIONS cust_geo_location
category_id product_id product_id date_of_birth
category_name product_name language_id marital_status
category_description product_description translated_name gender
parent_category_id category_id translated_description income_level
weight_class
warranty_period
supplier_id WAREHOUSES
INVENTORIES
product_status warehouse_id
product_id
list_price warehouse_spec
warehouse_id
min_price warehouse_name
quantity_on_hand
catalog_url location_id
wh_geo_location

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


The Human Resources Schema

1 - 29 Copyright © 2008, Oracle. All rights reserved.


Summary

In this lesson, you should have learned how to:


• Describe the goals of the course
• Identify the environments that can be used in this course
• Describe the database schema and tables that are used in
the course
• List the available documentation and resources

1 - 30 Copyright © 2008, Oracle. All rights reserved.


Practice 1 Overview: Getting Started

This practice covers the following topics:


• Reviewing the available SQL Developer resources
• Starting SQL Developer and creating new database
connections and browsing the HR, OE, and SH tables
• Setting some SQL Developer preferences
• Executing SQL statements and an anonymous PL/SQL block
by using SQL worksheet
• Accessing and bookmarking the Oracle Database 11g
documentation and other useful Web sites

1 - 31 Copyright © 2008, Oracle. All rights reserved.

You might also like