Beginning Oracle Application Express 4 - Gault_ Doug.pdf

(76410 KB) Pobierz
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
THE EXPERT’S VOICE ® IN ORACLE
Beginning
Oracle Application
Express 4
Your ticket to easy and robust web-application development
using Oracle's powerful toolset for power-users, programmers,
and database administrators
Doug Gault, Karen Cannell,
Patrick Cimolini, Martin Giffy D'Souza,
and Timothy St. Hilaire
879373880.093.png
 
 
 
 
 
 
 
 
879373880.050.png 879373880.070.png 879373880.071.png 879373880.072.png 879373880.073.png 879373880.074.png 879373880.075.png 879373880.076.png 879373880.077.png 879373880.078.png 879373880.079.png 879373880.080.png 879373880.081.png 879373880.082.png 879373880.083.png 879373880.084.png 879373880.085.png 879373880.086.png 879373880.087.png 879373880.088.png 879373880.089.png
 
879373880.090.png 879373880.091.png 879373880.092.png
 
 
 
 
 
 
 
 
 
 
 
 
 
879373880.094.png
 
 
 
879373880.095.png 879373880.096.png 879373880.097.png 879373880.098.png 879373880.099.png 879373880.100.png 879373880.101.png 879373880.102.png 879373880.103.png 879373880.104.png 879373880.105.png 879373880.106.png 879373880.107.png 879373880.108.png
 
879373880.109.png
 
879373880.110.png
 
879373880.111.png
 
879373880.112.png
 
879373880.113.png 879373880.114.png 879373880.115.png 879373880.116.png 879373880.117.png 879373880.118.png 879373880.119.png 879373880.120.png 879373880.121.png 879373880.122.png 879373880.123.png
 
879373880.001.png 879373880.002.png 879373880.003.png 879373880.004.png 879373880.005.png 879373880.006.png 879373880.007.png 879373880.008.png 879373880.009.png 879373880.010.png 879373880.011.png 879373880.012.png 879373880.013.png 879373880.014.png 879373880.015.png 879373880.016.png 879373880.017.png 879373880.018.png 879373880.019.png 879373880.020.png 879373880.021.png 879373880.022.png 879373880.023.png 879373880.024.png 879373880.025.png 879373880.026.png 879373880.027.png 879373880.028.png 879373880.029.png 879373880.030.png 879373880.031.png 879373880.032.png 879373880.033.png 879373880.034.png 879373880.035.png 879373880.036.png 879373880.037.png 879373880.038.png 879373880.039.png 879373880.040.png 879373880.041.png 879373880.042.png 879373880.043.png 879373880.044.png 879373880.045.png 879373880.046.png 879373880.047.png 879373880.048.png 879373880.049.png 879373880.051.png 879373880.052.png 879373880.053.png
 
For your convenience Apress has placed some of the front
matter material after the index. Please use the Bookmarks
and Contents at a Glance links to access them.
879373880.054.png 879373880.055.png 879373880.056.png 879373880.057.png 879373880.058.png 879373880.059.png 879373880.060.png 879373880.061.png
Contents at a Glance
Contents ..................................................................................................................... v
About the Authors .................................................................................................... xv
Acknowledgments .................................................................................................. xvii
Chapter 1: An Introduction to APEX 4 ..................................................................... 1
Chapter 2: A Developer’s Overview......................................................................... 7
Chapter 3: Identifying the Problem & Designing the Solution............................... 31
Chapter 4: SQL Workshop...................................................................................... 39
Chapter 5: Application and Navigation.................................................................. 61
Chapter 6: Forms and Reports – The Basics ......................................................... 99
Chapter 7: Forms and Reports – Advanced......................................................... 155
Chapter 8: Programmatic Elements .................................................................... 207
Chapter 9: Security ............................................................................................. 245
Chapter 10: Application Deployment................................................................... 273
Chapter 11: Understanding Websheets ............................................................... 281
Chapter 12: A Websheet Example ....................................................................... 313
Chapter 13: Extended Developer Tools................................................................ 333
Chapter 14: Managing Workspaces .................................................................... 355
Chapter 15: Team Development .......................................................................... 375
Index ....................................................................................................................... 405
iv
879373880.062.png 879373880.063.png 879373880.064.png 879373880.065.png 879373880.066.png 879373880.067.png 879373880.068.png
C H A P T E R 1
■ ■ ■
An Introduction to APEX 4
Welcome to the wonderful world of Oracle Application Express (APEX). You’re about to learn how to use
a tool that we believe will revolutionize the way you think about and approach writing web-based Oracle
systems. It certainly has for us.
Prior to the advent of APEX, developing fully interactive web based systems over data that resided
within an Oracle database almost always meant learning a new and often complex language like Java,
.NET, or PHP and then figuring out how to integrate your chosen language seamlessly with the data that
resided in your database. Often this also meant trying to incorporate business rules that were already
coded in the form of PL/SQL.
In such situations, it could take months or even years just to become proficient enough with your
chosen language to begin to write a functional system. If you’re like many, you’ll become frustrated with
the fact that you’ve spend an inordinate amount of time to do what seems like a relatively easy task.
Fear not! The days of long-winded and complex web development platforms may just be behind us.
What is APEX?
APEX is a 100% browser-based rapid application development (RAD) tool that helps you to create rich
interactive Oracle-based web applications very quickly and with relatively little programming effort.
There are many RAD development tools and platforms on the market. If you’re dealing with data
that resides in an Oracle database, there are a number of things that makes APEX distinctive and thus
more attractive as a development platform. First and foremost is the fact that APEX is built on and uses
as its core languages, SQL, and PL/SQL. This is a huge advantage for those of you who have already been
working with the Oracle database because it means you can immediately draw on what you know. Even
for those who don’t have an Oracle background, if you are going to be working with an Oracle database,
you’ll need to learn about its particular flavor of SQL and will at some point likely find a need for the
PL/SQL procedural language.
This fact becomes even more beneficial if you are migrating an Oracle-based system to APEX that
already has a significant amount of business logic coded into stored PL/SQL program units. In this
instance, you can almost immediately take advantage of that logic with very little effort or change to the
existing code.
Another great advantage is that APEX is a declarative tool that provides a feature rich core designed
to make your job easier. Because APEX takes care of many of the underlying functions common to all
web-based applications you are able to focus on the logic specific to your application.
A large share of what you need to accomplish can be done by using one of the many built-in wizards
provided as part of the APEX Application Builder. The wizards walk you through the process of defining
what you want your application to do and then stores that information as metadata. Once the wizard is
complete you can edit and enhance the functionality, or even replace it with your own custom SQL and
PL/SQL routines. After you become proficient with APEX you might even find yourself bypassing the
wizards altogether and generating more complex definitions directly.
1
879373880.069.png
CHAPTER 1 AN INTRODUCTION TO APEX 4
During the course of the book, you will discover that you will likely want a few other tools at your
disposal, but in truth, you could easily develop a very rich application using nothing but your web
browser and what APEX provides for you.
A Brief History of APEX
APEX has been around for quite some time—perhaps even longer than most people know. The first
public release of APEX, or HTML DB as it was called then, came in 2004, but its history reaches back
quite a long way.
Ancient History
APEX has its roots in technology that has been around for quite some time. In fact, parts of the PL/SQL
Web Toolkit, which is used under the covers by APEX to generate the HTML that is sent to the browser,
date back to as early as 1994.
At that point in time, you could actually write web applications in PL/SQL by hand, and
unfortunately we did. This required not only a thorough knowledge of PL/SQL and HTML but also the
patience of a saint and the determination of a headstrong mule. The end result wasn’t very pretty, and it
was definitely not secure by today’s terms, but it was functional, if somewhat limited.
Not long after, Oracle introduced PL/SQL Server Pages (PSPs). This involved first coding the static
HTML and including special Oracle markup to indicate where dynamic data would go. Once you had the
output looking as you wanted, you then ran it through a program called
LOADPSP
. This would translate
the raw HTML and the special Oracle markup into a PL/SQL procedure that, again, used the PL/SQL
Web Toolkit to emit the HTML including the dynamic data you requested. At the time, this was a huge
leap forward. I worked at a company where we actually built an entire framework around using PSP
technology and deployed it at several clients.
Finally, in 1997, WebDB came on the scene. The true grandfather of what we now call APEX, WebDB
was revolutionary in that it was a 100% web-based tool that allowed developers to design web
applications. It was written entirely in PL/SQL even though Java seemed to be taking over the world.
Developers could point WebDB at their database and generate code that would produce forms, reports,
charts, and calendars. There was no session state management or templates; once the code was
generated, there was no going back through the tool.
WebDB allowed a large number of companies who wanted to jump on the web-based bandwagon to
do so without spending vast amounts of time and effort in retraining their staff. As a tribute to its
success, I know of a number of companies that still have WebDB system running in production
environment.
Unfortunately WebDB’s days were numbered. Because it generated code (and if you didn’t like the
code it generated, then too bad for you), it had already begun to fade from favor by the time it was
absorbed into Oracle’s Portal product. However, creator Mike Hichwa did not forget the glimpse of
greatness that WebDB had seen.
More Recent History
Around 1999, Oracle’s CEO, Larry Ellison presented Mike Hichwa (VP of Software Development) with the
task of creating an internal calendaring and scheduling system for Oracle Corp. The original remit was to
use WebDB to generate the initial code and then hand code all the changes from that point forward.
Mike, however, saw this as an opportunity to completely re-write WebDB into something that could be
far more useful. Thus, with the help of Joel Kallman and Tom Kyte, Oracle Flows was born.
Based on the success of the internal Calendaring and Scheduling system, the team was allowed to
move forward towards making Oracle Flows a product. In 2001, using what then known as Flow Builder,
2
Zgłoś jeśli naruszono regulamin