Vous êtes sur la page 1sur 27

Oracle (in ancient Greece, someone in touch with the deities; from Latin,

oraculum or divine announcement) says it is the world's leading supplier of


software for information management but it is best known for its sophisticated
relational database products (notably Oracle9i), which are used in Fortune 1000
corporations and by many of the largest Web sites. Oracle's relational database was
the world's first to support the Structured Query Language (SQL), now an industry
standard.

The Programs (which include both the software and documentation) contain
proprietary information of Oracle Corporation; they are provided under a license
agreement containing restrictions on use and disclosure and are also protected by
copyright, patent and other intellectual and industrial property laws. Reverse
engineering, disassembly or decompilation of the Programs, except to the extent
required to obtain interoperability with other independently created software or as
specified by law, is prohibited. The information contained in this document is
subject to change without notice. If you find any problems in the documentation,
please report them to us in writing. Oracle Corporation does not warrant that this
document is error-free. Except as may be expressly permitted in your license
agreement for these Programs, no part of these Programs may be reproduced or
transmitted in any form or by any means, electronic or mechanical, for any
purpose, without the express written permission of Oracle Corporation. If the
Programs are delivered to the U.S. Government or anyone licensing or using the
programs on behalf of the U.S. Government, the following notice is applicable:
Restricted Rights Notice Programs delivered subject to the DOD FAR Supplement
are "commercial computer software" and use, duplication, and disclosure of the
Programs, including documentation, shall be subject to the licensing restrictions set
forth in the applicable Oracle license agreement. Otherwise, Programs delivered
subject to the Federal Acquisition Regulations are "restricted computer software"
and use, duplication, and disclosure of the Programs shall be subject to the
restrictions in FAR 52.227-19, Commercial Computer Software - Restricted Rights
(June, 1987). Oracle Corporation, 500 Oracle Parkway, Redwood City, CA 94065.
The Programs are not intended for use in any nuclear, aviation, mass transit,
medical, or other inherently dangerous applications. It shall be the licensee's
responsibility to take all appropriate fail-safe, backup, redundancy, and other
measures to ensure the safe use of such applications if the Programs are used for
such purposes, and Oracle Corporation disclaims liability for any damages caused
by such use of the Programs. Oracle is a registered trademark, and Oracle9i,
Oracle8i, Oracle7, Oracle Store, Oracle Transparent Gateway, PL/SQL, Pro*C,
Pro*Cobol, Pro*C/C++, Express, SQL*Net, and SQL*Plus are trademarks or
registered trademarks of Oracle Corporation. Other names may be trademarks of
their respective owners.

Why Oracle - ?

The Oracle WebLogic 11g application server product line is the industry's most
comprehensive Java platform for developing, deploying, and integrating enterprise
applications. It provides the foundation for application grid, which is an
architecture that enables enterprises to outperform their competitors while
minimizing operational costs.

• Outperform Your Competition—Fast, scalable systems enable IT to change as the


business grows

• Lower Operational Costs—Superior manageability with automation reduces the


time and expense of keeping systems up and running

• Best for Oracle Portfolio—The product line is well integrated with the rest of
Oracle's portfolio and has excellent support for interoperability with other systems

SQL - AN INTRODUCTION
The language, Structured English Query Language (“SEQUEL”)
was developed by IBM Corporation, Inc., to use Codd’s model.
SEQUEL later became SQL (still pronounced “sequel”). In 1979,
Relational Software, Inc. (now Oracle Corporation) introduced the
first commercially available implementation of SQL. Today, SQL is
accepted as the standard RDBMS language. Working of SQL The
strengths of SQL benefit all types of users, including application
programmers, database administrators, management, and end
users. Technically speaking, SQL is a data sublanguage: the
purpose of SQL is to provide an interface to a relational database
such as Oracle, and all SQL statements are instructions to the
database. In this it differs from general-purpose programming
languages like C and BASIC. Among the features of SQL are the
following:

• It processes sets of data as groups rather than as individual


units.

• It provides automatic navigation to the data. Essentially, SQL


lets you work with data at the logical level. You need to be
concerned with the implementation details only when you want to
manipulate the data. For example, to retrieve a set of rows from a
table, you define a condition used to filter the rows. All rows
satisfying the condition are retrieved in a single step and can be
passed as a unit to the user, to another SQL statement, or to an
application. You need not deal with the rows one by one, nor do
you have to worry about how they are physically stored or
retrieved. All SQL statements use the optimizer, a part of Oracle
that determines a fast means of accessing the specified data.
Oracle also provides techniques you can use to make the
optimizer perform its job better.

SQL provides commands for a variety of tasks, including:

• querying data

• inserting, updating, and deleting rows in a table

• creating, replacing, altering, and dropping objects

• controlling access to the database and its objects

• guaranteeing database consistency and integrity SQL unifies all


of the above tasks in one consistent language.

Oracle - Getting Started with Oracle

The concept of the relational database was first described around 1970 by Dr.
Edgar F. Codd .Oracle database helps in achieving reliable, flexible, secured and
cost effective way to manage information and applications. Oracle offers high
performance and scalability, because all computing resources can be flexibly
allocated to applications as needed.

In oracle the logical and physical structures are separate and thus this helps in
physical storage of data can be managed without affecting the access to logical
storage structures. Oracle is a major database which along with its added features
passes the ACID test, which is important in insuring the integrity of data. Oracle is
very much suited for enterprise computing and large database applications because
of the following:

Oracle provides greater Performance and scalability


• Helps in achieving greater reliability. That is in other words continuous
availability of data and applications.
• Have many features for maintaining the security of data.

Oracle has advanced integration features that allow applications and data to run
anywhere in the network and thus offering distributed network. ORACLE consists
of many tools that allow one to create an application with ease and flexibility.
Several of the more useful features available to ORACLE application developers
are integrity constraints, stored procedures and packages, database triggers, cost-
based optimizer, shared SQL, locking and sequences and some more are namely

Automatic Storage Management: Oracle has in it Automatic Storage


Management also called as ASM in short which helps in simplifying the
administration of Oracle database files.

Oracle Scheduler: Oracle Scheduler helps in scheduling and performs various IT


tasks.

Table space: The main feature of oracle is that the table space in it, helps in
extracting data files from database and move or copy them to another location or
even put them in another database by the concept of Transportable Table spaces in
Oracle.

Oracle is available in different forms like namely:

• Personal Oracle
• Oracle Standard Edition
• Oracle Enterprise Edition
• Oracle Lite

Personal Oracle: It is a database ideal for single users and is used to develop
code for implementation on other Oracle multi-user databases.

Oracle Standard Edition: Oracle Standard Edition was named Workgroup Server
in its first iteration as part of the Oracle7 family and is often simply referred to as
Oracle Server. Oracle Standard Edition is available on Windows NT, Netware, and
UNIX platforms such as Compaq (Digital), HP/UX, IBM AIX, Linux, and Sun
Solaris. The Oracle Standard Edition is useful for small number of users and a
smaller database.

Oracle Enterprise Edition: This includes additional functionality and is used for
larger-scale implementations. Thus it is used for a large number of users or a large
database with advanced features for extensibility, performance, and management.

Oracle Lite: This is also called as Oracle Mobile and this is used for single users
who are using wireless devices. Thus this is used in lightweight database engine
for mobile computing on notebooks and handheld devices.

The latest version of oracle has full support for polymorphism, inheritance
and most all of the OO constructs. Oracle also provides the concept of dimension
objects. A dimension object is a description of the hierarchies inherent in the fact
table and is used by Oracle to optimize execution plans and thereby helps in
achieving higher performance level in the application. The ‘i’ in version of oracle
like oracle 8i was added to denote added functionality supporting Internet
deployment in the new version.

There are various branches in which one can go into by learning oracle like
be a functional consultant, or a Database administrator DBA in short, Oracle
PL/SQL Developer Certified Associate designation, Oracle Forms Developer
Certified Professional designation and so on.

Oracle character

Following are the tables which have characteristics of packages, procedures or


functions -

1) USER_OBJECTS - Details like name, type, creation and updation dates and
status. This table can be viewed by the current user. Similary ALL_OBJECTS
(objects accessible to this owner) or DBA_OBJECTS (for objects accessible to
DBAs)

2) USER_SOURCE - Details such as name, type, line no and text. This is the
source code of package/function/procedure. ALL_SOURCE or DBA_SOURCE as
described above.

3) USER_ERRORS - Details of errors giving name, line no and error msg and text.
ALL_ERRORS and DBA_ERRORS as described above.

History

Corporate/technical timeline

• 1977: Larry Ellison and friends founded Software Development


Laboratories.

• 1979: SDL changed its company-name to "Relational Software, Inc." (RSI)


and introduced its product Oracle V2 as an early commercially-available
relational database system. The version did not support transactions, but
implemented the basic SQL functionality of queries and joins. (RSI never
released a version 1 - instead calling the first version version 2 as a
marketing gimmick.)[30]

• 1982: RSI in its turn changed its name, becoming known as "Oracle
Corporation", to align itself more closely with its flagship product.

• 1983: The company released Oracle version 3, which it had re-written using
the C programming language and which supported COMMIT and
ROLLBACK functionality for transactions. Version 3 extended platform
support from the existing Digital VAX/VMS systems to include Unix
environments.[31]

• 1984: Oracle Corporation released Oracle version 4, which supported read-


consistency.

• 1985: Oracle Corporation released Oracle version 5, which supported the


client-server model—a sign of networks becoming more widely available in
the mid-1980s.

• 1986: Oracle version 5.1 started supporting distributed queries.

• 1988: Oracle RDBMS version 6 came out with support for PL/SQL
embedded within Oracle Forms v3 (version 6 could not store PL/SQL in the
database proper), row-level locking and hot backups.

• 1989: Oracle Corporation entered the application products market and


developed its ERP product, (later to become part of the Oracle E-Business
Suite), based on the Oracle relational database.

• 1990: the release of Oracle Applications release

• 1992: Oracle version 7 appeared with support for referential integrity, stored
procedures and triggers.

• 1997: Oracle Corporation released version 8, which supported object-


oriented development and multimedia applications.
• 1999: The release of Oracle8i aimed to provide a database inter-operating
better with the Internet (the i in the name stands for "Internet"). The Oracle
8i database incorporated a native Java virtual machine (Oracle JVM).

• 2000: Oracle E-Business Suite 11i pioneers integrated enterprise application


software[31]

• 2001: Oracle9i went into release with 400 new features, including the ability
to read and write XML documents. 9i also provided an option for Oracle
RAC, or "Real Application Clusters", a computer-cluster database, as a
replacement for the Oracle Parallel Server (OPS) option.

• 2003: Oracle Corporation released Oracle Database 10g. (The g stands for
"grid"; emphasizing a marketing thrust of presenting 10g as "grid-computing
ready".)

• 2005: Oracle Database 10.2.0.1—also known as Oracle Database 10g


Release 2 (10gR2)—appeared.

• 2006: Oracle Corporation announces Unbreakable Linux[31]

• 2007: Oracle Database 10g release 2 sets a new world record TPC-H 3000
GB benchmark result[33]

• 2007: Oracle Corporation released Oracle Database 11g for Linux and for
Microsoft Windows.

• 2008: Oracle Corporation acquires BEA Systems.

• 2009: Oracle Corporation acquires Sun Microsystems. Note: as of


November 2009[update] the acquisition awaits approval from the European
Commission

Version numbering
Oracle products have historically followed their own release-numbering and
naming conventions. With the Oracle RDBMS 10g release, Oracle Corporation
started standardizing all current versions of its major products using the "10g"
label, although some sources continued to refer to Oracle Applications Release 11i
as Oracle 11i. Major database-related products and some of their versions include:

• Oracle Application Server 10g (also known as "Oracle AS 10g"): a


middleware product;

• Oracle Applications Release 11i (aka Oracle e-Business Suite, Oracle


Financials or Oracle 11i): a suite of business applications;

• Oracle Developer Suite 10g (9.0.4);

• Oracle JDeveloper 10g: a Java integrated development environment;

Since version 5, Oracle's RDBMS release numbering has used the following codes:

• Oracle5

• Oracle6

• Oracle7: 7.0.16—7.3.4

• Oracle8 Database: 8.0.3—8.0.6

• Oracle8i Database Release 1: 8.1.5.0—8.1.5.1

• Oracle8i Database Release 2: 8.1.6.0—8.1.6.3

• Oracle8i Database Release 3: 8.1.7.0—8.1.7.4

• Oracle9i Database Release 1: 9.0.1.0—9.0.1.5 (patchset as of December


2003[update])

• Oracle9i Database Release 2: 9.2.0.1—9.2.0.8 (patchset as of April


2007[update])
• Oracle Database 10g Release 1: 10.1.0.2—10.1.0.5 (patchset as of February
2006[update])

• Oracle Database 10g Release 2: 10.2.0.1—10.2.0.4 (patchset as of April


2008[update])

• Oracle Database 11g Release 1: 11.1.0.6—11.1.0.7 (patchset as of


September 2008[update])

• Oracle Database 11g Release 2: 11.2.0.1 (released 2009-09-01)

The version-numbering syntax within each release follows the pattern:


major.maintenance.application-server.component-specific.platform-specific.

For example, "10.2.0.1 for 64-bit Solaris" means: 10th major version of Oracle,
maintenance level 2, Oracle Application Server (OracleAS) 0, level 1 for Solaris
64-bit.

The Oracle Administrator's Guide offers further information on Oracle release


numbers. Oracle Corporation provides a table[34] showing the latest patch-set
releases by major release, operating-system, and hardware-architecture.

Oracle is made up of a set of processes running in your operating system. These


processes manage how data is stored and how it is accessed. I will cover these
processes in detail in the future; but for now we just need to understand that Oracle
is a program that is running in the background, maintaining your data for you and
figuring out where it should go on your hard drive.

Some of Oracle's tools to access the database and create programs are:

SQL*Plus
It has a command line interface. With it, you can access the database and write
stored procedures, you can run SQL commands to retrieve data and you can run
scripts of either SQL, PL/SQL or built-in SQL*Plus commands, or a mixture of
those three things.

Oracle Developer

Oracle developers is a 4GL GUI application Builder. With Developer, you can
create forms, reports, and graphics. Oracle*Forms and Oracle*Reports are two
components of Oracle Developer. Earlier versions created client-server
applications, but the more recent versions create web applications that run under
the Oracle Application Server (OAS). OAS is a web-based application server sold
by Oracle. OAS is licensed separately and is very expensive (as are its closed
source competitors). The current version is OAS 10g.

HTML DB

It is a fairly new application builder geared toward web development (added to the
DB with release 9iR2). HTML DB does not need an application server. This tool
runs from the database and can be presented to the web using the Apache web
server that comes with the database. Since this is not an additional license, it
provides a cheaper way to develop applications. Developer is a feature-rich thick
client with all of the normal GUI widgets. HTML DB is HTML-based and is very
thin and limited to the HTML provided widgets.

Oracle Enterprise Manager (OEM)

OEM is the Enterprise GUI tool to manage the database. From this tool, you can
perform any action in the database that is required. This tool is primarily used for
administration but can also be provided to developers for application tuning and
monitoring. In Oracle 10g, OEM also provides Grid control.

There are also a lot of third party tools for accessing the database. For our
purposes, our primary tool for data access will be SQL*Plus. In the future, I will
cover creating applications with HTML DB and accessing your data with some
choice third-party tools.

How about Java? Java is the current hot language, especially on the web. I will also
be covering Java in the database in future articles. Java is natively supported by
Oracle. Technically, you could use Java to create your stored procedures if you
chose, but I am not a proponent of that. When you are working inside the database,
I believe that you should only resort to Java when you cannot accomplish a task in
PL/SQL. As you'll see, there is very little you cannot accomplish with PL/SQL.

It will be hard to learn Oracle if you can't play with it. So where can you get access
to this software? Oracle has a technical web site called OTN (Oracle Tech Net)
that provides access to all of Oracle's software and all of the documentation for that
software. There are also forums and many other tools to use to help you learn
Oracle. You have to register to access it, but registration is free. Go to
http://otn.oracle.com/ and get an ID today. In future articles, I will be spending a
lot of time accessing this web site to download software and documentation. My
next article will cover downloading Oracle 10g and installing it.

As a side note, Oracle provides all of their software with a developer's license. This
license allows you to try out the software free of charge. You may not create
production applications without a paid license, but development with the tools is
acceptable. I am not a lawyer, so I recommend that you review the license when
you download any software from OTN.
Also, a note about versioning in Oracle; all products released by Oracle have a
version. The current version of the database is 10g Release 1, also written as
10gR1. In addition to this semantic release name, each release has a numeric
version. The numeric release for 10gR1 is 10.0.1.3.

Advantages of Using Oracle


Oracle has many advantages and features that makes it popular and thereby
makes it as the world's largest enterprise software company. Oracle comes with
new versions with new features implemented in new version while the features of
earlier versions still being maintained. One important aspect is Oracle databases
tend to be backwards compatible. Also when Oracle releases a new version, their
documentation contains a list of all the features new to that version thus makes it
user friendly for one to learn the new features.

Oracle takes a lead role because of some of the following reasons:

Oracle is used for almost all large application and one of the main applications in
which oracle takes its major presence is banking. In fact ten of the world’s top 10
banks run Oracle applications this is because oracle offers a powerful combination
of technology and comprehensive, pre-integrated business applications, including
key functionality built specifically for banks.

Some similar databases like Sybase, SQL-Server one have facilities for using
loops, conditions, arrays and so on in a program and also facilities like cursors and
temp tables but all this would be used in a convoluted fashion which are very slow
and resource consuming operations. The operations are not implemented as in
Oracle which is efficient enough.

Also with the features available in oracle with the earlier versions in market the
oracle company keeps upgrading and releasing new products into market, new
versions releases which serves better than the earlier versions and thus the
performance is improved much in later versions and thereby retaining the market
growth and thus proves greater satisfaction to the customers using this technology.
Thus the advantage of a higher version is that one would have more features and
better capabilities.

For instance oracle 8i version has many new features which helped users namely
like with oracle 8i one could run Java in the database, had features like new
features on partitioning to support large database and so on. With the next version
9i oracle had these facilities maintained and had more new facilities added to it
namely like new features added to help the DBA to handle change database
configuration and so on.

Oracle is a database that responds very well with excellent performance in


demanding environments. Oracle is a major database which along with its added
features passes the ACID test, which is important in insuring the integrity of data.
This is very important because data is the heart of any system in organization. A
reliable and adequate database system has the following properties:

Atomicity:
That is Results of a transaction's execution are either all committed or all rolled
back.

Consistency:
The database is transformed from one valid state to another valid state. Illegal
transactions aren't allowed and, if an integrity constraint can't be satisfied then the
transaction is rolled back.

Isolation:
The results of a transaction are invisible to other transactions until the transaction
is complete thus increasing the security on data.

Durability:
Once committed (completed), the results of a transaction are permanent and
survive future system and media failures and thus ensuring maintenance and
protection of data.

All the above are well maintained by Oracle database.

The latest version oracle 10g has many features and one new feature is the
introduction of recycle bin. This option when enabled could be used by users just
like Windows recycle bin or Mac Trash. Dropped tables go "into" the recycle bin,
and can be restored from the recycle bin.

One of the main advantage of oracle over other databases is in its recent version
oracle has the concept of Flashback technology. That is we all know that data is the
heart of any application or organization and thus this requires careful maintenance.
But sometimes application outage can occur and mostly DBA claim the reasons for
this as hardware failure and apart from this the reason would be human errors like
accidental deletion of valuable data, deleting the wrong data, or dropping the
wrong table. So it is very essential to take care of such situation and this is done in
oracle's latest technology called flash introduced in its latest version. By Flash
technology it helps in recovery by working just on the changed data. Thus
Flashback provides an
• Efficient recovery from human errors
• Faster database recovery
• Helps in simplifying the management and administration processes

and so on.

AN EXAMPLE OF HOW ORACLE WORKS

The following example illustrates an Oracle configuration where the user and
associated server process are on separate machines (connected via a network). 1. 2.
An instance is currently running on the computer that is executing Oracle (often
called the host or database server). A computer running an application (a local
machine or client workstation) runs the application in a user process. The client
application attempts to establish a connection to the server using the proper Net8
driver. The server is running the proper Net8 driver. The server detects the
connection request from the application and creates a (dedicated) server process on
behalf of the user process. The user executes a SQL statement and commits the
transaction. For example, the user changes a name in a row of a table. The server
process receives the statement and checks the shared pool for any shared SQL area
that contains an identical SQL statement. If a shared SQL area is found, the server
process checks the user’s access privileges to the requested data and the previously
existing shared SQL area is used to process the statement; if not, a new shared
SQL area is allocated for the statement so that it can be parsed and processed. The
server process retrieves any necessary data values from the actual datafile (table)
or those stored in the system global area. The server process modifies data in the
system global area. The DBWn process writes modified blocks permanently to
disk when doing so is efficient. Because the transaction committed, the LGWR
process immediately records the transaction in the online redo log file. If the
transaction is successful, the server process sends a message across the network to
the application. If it is not successful, an appropriate error message is transmitted.
Throughout this entire procedure, the other background processes run, watching
for conditions that require intervention. In addition, the database server manages
other users’ transactions and prevents contention between transactions that request
the same data.

Oracle Net Services

Connectivity

After a network session is established, Oracle Net Services acts as a data courier
for the client application and the database server. It is responsible for establishing
and maintaining the connection between the client application and database server,
as well as exchanging messages between them. Oracle Net Services is able to
perform these jobs because it is located on each computer in the network.

Manageability

Oracle Net Services provides location transparency, centralized configuration and


management, and quick out-of-the-box installation and configuration.

Internet Scalability

Oracle Net Services enables you to maximize system resources


and improve performance. Oracle’s shared server architecture
increases the scalability of applications and the number of clients
simultaneously connected to the database.The Virtual Interface
(VI) protocol places most of the messaging burden on high-speed
network hardware, freeing the CPU for more important tasks.
Internet Security

Network security is enhanced with features like database access


control and Oracle Advanced Security.

Using Java with Oracle Database

Oracle Database is a relational database that you can use to


store, use, and modify data. The Java Database Connectivity
(JDBC) standard is used by Java applications to access and
manipulate data in relational databases. JDBC is an industry-
standard application programming interface (API) developed by
Sun Microsystems that lets you embed SQL statements in Java
code. JDBC is based on the X/Open SQL Call Level Interface (CLI)
and complies with the SQL92 Entry Level standard. Each vendor,
such as Oracle, creates its JDBC implementation by implementing
the interfaces of the standard java.sql package.

PL/SQL

SQL is a declarative language that allows database programmers to write a SQL


declaration and hand it to the database for execution. As such, SQL cannot be used
to execute procedural code with conditional, iterative and sequential statements. To
overcome this limitation, PL/SQL was created.

PL/SQL is Oracle's Procedural Language extension to SQL. PL/SQL's language


syntax, structure and data types are similar to that of Ada. Some of the statements
provided by PL/SQL:
The PL/SQL language includes object oriented programming techniques such as
encapsulation, function overloading, information hiding (all but inheritance).

PL/SQL is commonly used to write data-centric programs to manipulate data in an


Oracle database.

Ah, for the good old days of Version 1.0 of PL /SQL! Life was so simple
then. No stored procedures or functions -- and certainly no packages. You had your
set of built-in functions, like SUBSTR and TO_DATE. You had the IF statement
and various kinds of loops. With these tools at hand, you built your batch-
processing scripts for execution in SQL*Plus, and you coded your triggers in
SQL*Forms 3.0, and you went home at night content with a good day's work done.

Of course, there was an awful lot you couldn't do with PL /SQL 1.0 -- such as
build complex, robust, large-scale applications, or read and write operating system
files, or manipulate data in array structures, or debug your code effectively, or
store your business formulas in reusable program units.

Sure, life was simpler back when you were stuck with PL /SQL 1.0. You just too
frequently told your manager or your users that what they wanted done was, well,
impossible. Fortunately, Oracle recognized that it would be so much nicer for both
its users and its bottom line if its bedrock technology (most importantly, the Oracle
RDBMS and PL /SQL) could actually meet user needs. So it came out with PL
/SQL Version 2 (which works with Version 7 of the Oracle Server) and then, most
recently, PL /SQL Version 8.0 (to accompany Oracle8). In each major version and
its sub-releases (2.1, 2.2, 2.3, and, sometime in 1998, 8.1), Oracle has added major
new functionality. As a result, hundreds of thousands of software programmers
now use PL /SQL to implement sophisticated applications.

Easily the most important new feature of PL /SQL2 was the introduction of
packages. Packages (explored in more detail in the next section) allow you to
collect together related program elements and control access to those elements.
Anyone who develops PL /SQL applications should employ packages at the very
core of their layers of reusable code -- and Oracle Corporation itself is no
exception. Starting with PL /SQL 2.0 and continuing through every subsequent
release, Oracle has made available to PL /SQL developers a series of built-in
packages, which extend the functionality of PL /SQL in many fascinating and
important directions.

It is no longer sufficient to be aware of and expert in only the core elements of


PL /SQL. Getting a handle on IF statements, loops, and the built-in functions like
INSTR and TO_CHAR is now only the first phase in your journey towards PL
/SQL expertise. To take full advantage of the PL /SQL language, developers must
now also learn how to use the programs contained in the built-in packages. And,
believe me, once you make a few discoveries in these built-in packages, you will
be amazed -- and you will be addicted. You will eagerly troll this book for features
you can apply in new and creative ways to solve your problems.

Difference between SQL and PL/SQL

Both SQL and PL/SQL are languages used to access data within Oracle databases.

SQL is a limited language that allows you to directly interact with the database.
You can write queries (SELECT), manipulate objects (DDL) and data (DML) with
SQL. However, SQL doesn't include all the things that normal programming
languages have, such as loops and IF...THEN...ELSE statements.

PL/SQL is a normal programming language that includes all the features of most
other programming languages. But, it has one thing that other programming
languages don't have: the ability to easily integrate with SQL.

Some of the differences:

SQL is executed one statement at a time. PL/SQL is executed as a block of


code.
SQL tells the database what to do (declarative), not how to do it. In contrast,
PL/SQL tell the database how to do things (procedural).

SQL is used to code queries, DML and DDL statements. PL/SQL is used to
code program blocks, triggers, functions, procedures and packages.

You can embed SQL in a PL/SQL program, but you cannot embed PL/SQL
within a SQL statement.

PL/SQL and Java appeal to different people in different job roles. The
following table briefly describes the similarities and difference between these
two language environments:

PL/SQL:

Can be used to create Oracle packages, procedures and triggers

Data centric and tightly integrated into the database

Proprietary to Oracle and difficult to port to other database systems

Data manipulation is slightly faster in PL/SQL than in Java

PL/SQL is a traditional procedural programming language

Java:

Can be used to create Oracle packages, procedures and triggers

Open standard, not proprietary to Oracle

Incurs some data conversion overhead between the Database and Java type

Java is an Object Orientated language, and modules are structured into classes

Java can be used to produce complete applications

Oracle8i and Java

In Oracle8i, Oracle includes a new product called JServer, which consists of the
following elements:
• Oracle's Java Virtual Machine (JVM), called Aurora, the supporting runtime
environment, and Java class libraries

• Tight integration with PL/SQL and Oracle RDBMS functionality

• An Object Request Broker (the Aurora/ORB) and Enterprise JavaBeans


(EJB)

• The JServer Accelerator (native compiler) (available in the 8.1.6 Enterprise


Edition only)

The Aurora JVM executes Java methods (also known as Java stored procedures)
and classes if they were stored in the database itself.

Java in the Oracle database is a big topic; Java programming all by itself is an even
bigger topic. Complete treatment of either is outside the scope of this book. My
objectives for this chapter are limited to the following:

• Providing the information you need to load Java classes into the Oracle
database, manage those new database objects, and publish them for use
inside PL/SQL

• Offering a basic tutorial in building Java classes that should give you enough
guidance to let you construct simple classes to access underlying Java
functionality

To access Java class methods from within Oracle, you must take the following
steps:

1. Create the Java code elements. You can do this in Oracle's JDeveloper, or in
any other Java Integrated Development Environment. (notepad.exe will also,
of course, do the trick in a pinch!)

2. Load the Java class(es) into Oracle using the loadjava command-line utility
or the CREATE JAVA statement.
3. Publish the Java class methods inside PL/SQL by writing wrapper programs
in PL/SQL around the Java code.

4. Grant privileges as required on the PL/SQL wrapper programs and the Java
class referenced by the PL/SQL wrapper

Oracle Advanced Queuing -

Oracle8 offers a facility (new to Oracle 8) called Oracle AQ (Oracle Advanced


Queuing, referred to as AQ in this chapter) that will make it much easier for
developers to build applications that require deferred execution of activity. Oracle
is positioning Oracle AQ as an alternative to the queuing mechanisms of
teleprocessing monitors and messaging interfaces. Oracle AQ will serve as a
foundation technology for workflow management applications, both those
delivered by Oracle Corporation itself and those implemented by third parties.

From a PL/SQL standpoint, Oracle AQ is made available through two packages:


DBMS_AQADM and DBMS_AQ. The DBMS_AQADM package is the interface
to the administrative tasks of Oracle AQ. These tasks include:

• Creating or dropping queue tables that contain one or more queues

• Creating, dropping, and altering queues, which are stored in a queue table

• Starting and stopping queues in accepting message creation or consumption

Most users of the Oracle AQ facility will not work with DBMS_AQADM. The
DBA will most likely initialize all needed queue tables and queues. PL/SQL
developers will instead work with the DBMS_AQ, whose tasks include:

• Creating a message to the specified queue

• Consuming a message from the specified queue


Most of the background information presented early in this chapter applies to both
packages. Later, we'll provide individual discussions of the two packages and their
programs.

Oracle AQ is full of features and offers tremendous flexibility in how you


manipulate messages in queues. It also has only a handful of programs with which
to administer and operate the queues. This relatively small number of procedures
and functions can, nevertheless, be misleading. You will probably encounter lots of
frustrating moments as you come up to speed on Oracle AQ (I know I did).

Some of the frustration will arise from the way that Oracle allows you to modify
the characteristics of queues, queue tables, and specific enqueue and dequeue
operations by setting individual fields of PL/SQL records, which are then passed to
the appropriate programs as arguments. If you are not comfortable with declaring
and manipulating record structures in PL/SQL, you should read through Chapter 9
of Oracle PL/SQL Programming (O'Reilly & Associates, 1997) before continuing
with this chapter.

APPLICATION - Oracle

1. Supply Chain Management

With Oracle SCM, companies can build and operate world class value-chains
for profitable growth. The Oracle E-Business Suite Supply Chain
Management (R12) family of applications integrates and automates all key
supply chain processes, from design, planning and procurement to
manufacturing and fulfillment, providing a complete solution set to enable
companies to power information-driven value chains. Companies can
anticipate market requirements and risks, adapt and innovate to respond to
volatile market conditions, and align operations across global networks. A
unified data model provides a single, accurate view of your entire supply
chain. Companies can implement lean, demand driven principles and manage
their increasingly complex, global supply chains. And when Oracle Supply
Chain Management runs on Oracle technology, you speed implementation,
optimize performance, streamline support – and maximize ROI.

Get Better Information. Make Smarter Decisions. Deliver Best Results.

Oracle Supply Chain Management R12 enables you to drive supply chain
processes based on real-time demand information, and in turn provide
customers accurate information on pricing and availability. The results – you
maximize value in your supply chain while increasing revenues and customer
satisfaction levels.

Gain Key, Industry-Specific Capabilities

From compliance issues to sourcing strategies, each industry has a unique set
of supply chain challenges. Oracle Supply Chain Management R12 provides
comprehensive solutions for the following industries: Airlines, Automotive,
Communications, Consumer Goods, High Technology, Industrial
Manufacturing, Life Sciences, and the Public Sector.

Support Global Networks and Outsourcing

Supply chain operations are increasingly global, with outsourcing playing a


key role. Oracle Supply Chain Management R12 enables you to collaborate
with partners across global regions, manage complex suppliers networks with
real-time information, and adapt quickly to global constraints and demand.
2. Enterprise Applications

Oracle E-Business Suite is the most comprehensive suite of integrated,


business applications that provides:

• The most complete, integrated
business intelligence portfolio

• The most adaptable global


business platform

• The most customer-focused


applications strategy

• Asset Lifecycle Management

Cucustomer Relationship Management

• Enterprise Resource Planning

• Channel Revenue Management


• Financial Management
• Human Capital Management
• Project Management
Procurement
• Product Lifecycle Management

• Supply Chain Management

• Global Trade Management


• Supply Chain Planning
• Logistics & Transportation Management
• Order Management

Vous aimerez peut-être aussi