Siêu thị PDFTải ngay đi em, trời tối mất

Thư viện tri thức trực tuyến

Kho tài liệu với 50,000+ tài liệu học thuật

© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Beginning Oracle Application Express 5
PREMIUM
Số trang
494
Kích thước
27.4 MB
Định dạng
PDF
Lượt xem
1770

Beginning Oracle Application Express 5

Nội dung xem thử

Mô tả chi tiết

Beginning Oracle

Application

Express 5

Your ticket to easy and robust

web-application development using

Oracle’s powerful toolset for

power-users, programmers, and

database administrators

Doug Gault

Whether you’re new to Oracle or an old hand who’s yet to test the waters of APEX, Beginning

Oracle Application Express 5 introduces the processes and best practices you’ll need to become

proficient with APEX. The book shows off the programming environment, the utilities and

tools available, and then continues by walking through the process of building a working

system from the ground up. All code is documented and explained so that those new to the

languages will not be lost. After reading this book, power users and programmers alike can

quickly put together robust and scalable applications for use by one person, by a department,

by an entire company.

Beginning Oracle Application Express 5 introduces version 5 of the popular and productive

Oracle Application Express development platform. Called APEX for short, the platform enables

rapid and easy development of web-based applications that make full use of Oracle Database.

The release of APEX 5 brings major new changes to the page builder, an enhanced universal

theme, better RESTful web services support, enhanced application packaging, and the many

redesigned wizards give a new and fresh feel to the user interface.

• Covers brand-new functionality in APEX 5

• Provides fully documented and explained example code

• Guides you through creating a working and fully deployable application

Beginning Oracle Application Express 5

www.apress.com

Gault Beginning Oracle Application Express 5

THE EXPERT’S VOICE® IN ORACLE

Shelve in:

Databases/Oracle

User level:

Beginning–Advanced

9 781484 204672 SOURCE CODE ONLINE

ISBN 978-1-4842-0467-2

www.it-ebooks.info

Beginning Oracle

Application Express 5

Doug Gault

www.it-ebooks.info

Beginning Oracle Application Express 5

Copyright © 2015 by Doug Gault

This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the

material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation,

broadcasting, reproduction on microfilms or in any other physical way, and transmission or information

storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now

known or hereafter developed. Exempted from this legal reservation are brief excerpts in connection with

reviews or scholarly analysis or material supplied specifically for the purpose of being entered and executed

on a computer system, for exclusive use by the purchaser of the work. Duplication of this publication or

parts thereof is permitted only under the provisions of the Copyright Law of the Publisher’s location, in its

current version, and permission for use must always be obtained from Springer. Permissions for use may be

obtained through RightsLink at the Copyright Clearance Center. Violations are liable to prosecution under

the respective Copyright Law.

ISBN-13 (pbk): 978-1-4842-0467-2

ISBN-13 (electronic): 978-1-4842-0466-5

Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol

with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only

in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the

trademark.

The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are

not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to

proprietary rights.

While the advice and information in this book are believed to be true and accurate at the date of publication,

neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or

omissions that may be made. The publisher makes no warranty, express or implied, with respect to the

material contained herein.

Managing Director: Welmoed Spahr

Lead Editor: Jonathan Gennick

Technical Reviewer: Warren Capps

Editorial Board: Steve Anglin, Louise Corrigan, Jonathan Gennick, Robert Hutchinson,

Michelle Lowman, James Markham, Matthew Moodie, Jeffrey Pepper, Douglas Pundick,

Ben Renow-Clarke, Gwenan Spearing

Coordinating Editor: Jill Balzano

Copy Editor: April Rondeau

Compositor: SPi Global

Indexer: SPi Global

Artist: SPi Global

Distributed to the book trade worldwide by Springer Science+Business Media New York,

233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, email

[email protected], or visit www.springeronline.com. Apress Media, LLC is a California LLC

and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc).

SSBM Finance Inc is a Delaware corporation.

For information on translations, please e-mail [email protected], or visit www.apress.com.

Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use.

eBook versions and licenses are also available for most titles. For more information, reference our Special

Bulk Sales–eBook Licensing web page at www.apress.com/bulk-sales.

Any source code or other supplementary material referenced by the author in this text is available to

readers at www.apress.com/. For detailed information about how to locate your book’s source code, go to

www.apress.com/source-code/.

www.it-ebooks.info

To those in search of knowledge and better understanding,

I dedicate this effort. Hopefully, as your skills grow,

you too will continue to share the wealth.

—Doug Gault

www.it-ebooks.info

www.it-ebooks.info

v

Contents at a Glance

About the Authors���������������������������������������������������������������������������������������������������xix

About the Technical Reviewer ��������������������������������������������������������������������������������xxi

Acknowledgments������������������������������������������������������������������������������������������������xxiii

■Chapter 1: An Introduction to APEX 5.0����������������������������������������������������������������� 1

■Chapter 2: A Developer’s Overview ����������������������������������������������������������������������� 7

■Chapter 3: Identifying the Problem and Designing the Solution�������������������������� 37

■Chapter 4: SQL Workshop������������������������������������������������������������������������������������ 45

■Chapter 5: Applications and Navigation �������������������������������������������������������������� 67

■Chapter 6: Forms and Reports: The Basics ������������������������������������������������������� 107

■Chapter 7: Forms and Reports: Advanced��������������������������������������������������������� 167

■Chapter 8: Programmatic Elements ������������������������������������������������������������������ 231

■Chapter 9: Security�������������������������������������������������������������������������������������������� 259

■Chapter 10: Application Bundling and Deployment������������������������������������������� 287

■Chapter 11: Understanding Websheets ������������������������������������������������������������� 309

■Chapter 12: A Websheet Example���������������������������������������������������������������������� 339

■Chapter 13: Extended Developer Tools �������������������������������������������������������������� 359

■Chapter 14: Managing Workspaces������������������������������������������������������������������� 383

www.it-ebooks.info

vi

■ Contents at a Glance

■Chapter 15: Team Development������������������������������������������������������������������������� 401

■Chapter 16: Dynamic Actions ���������������������������������������������������������������������������� 431

■Appendix A: Page Designer Walkthrough and Reference ���������������������������������� 449

Index��������������������������������������������������������������������������������������������������������������������� 469

www.it-ebooks.info

vii

Contents

About the Author ����������������������������������������������������������������������������������������������������xix

About the Technical Reviewer ��������������������������������������������������������������������������������xxi

Acknowledgments������������������������������������������������������������������������������������������������xxiii

■Chapter 1: An Introduction to APEX 5.0����������������������������������������������������������������� 1

What Is APEX? ������������������������������������������������������������������������������������������������������������������ 1

A Brief History of APEX����������������������������������������������������������������������������������������������������� 2

Ancient History ��������������������������������������������������������������������������������������������������������������������������������������� 2

More Recent History ������������������������������������������������������������������������������������������������������������������������������� 2

APEX 5.0 and the Future������������������������������������������������������������������������������������������������������������������������� 3

What You Need to Get Started ������������������������������������������������������������������������������������������ 4

Access to an APEX Instance ������������������������������������������������������������������������������������������������������������������� 5

Web Browser ������������������������������������������������������������������������������������������������������������������������������������������ 5

SQL Developer���������������������������������������������������������������������������������������������������������������������������������������� 5

Summary�������������������������������������������������������������������������������������������������������������������������� 6

■Chapter 2: A Developer’s Overview ����������������������������������������������������������������������� 7

The Anatomy of a Workspace������������������������������������������������������������������������������������������� 7

APEX Users ��������������������������������������������������������������������������������������������������������������������������������������������� 8

Applications, Pages, Regions, and Items ������������������������������������������������������������������������������������������������ 9

Workspaces, Applications, and Schemas ��������������������������������������������������������������������������������������������� 10

A Final Word on Workspaces ���������������������������������������������������������������������������������������������������������������� 12

A Tour of the APEX Modules ������������������������������������������������������������������������������������������� 12

The Home Page ������������������������������������������������������������������������������������������������������������������������������������ 13

Application Builder ������������������������������������������������������������������������������������������������������������������������������� 16

www.it-ebooks.info

viii

■ Contents

SQL Workshop �������������������������������������������������������������������������������������������������������������������������������������� 19

Packaged Apps ������������������������������������������������������������������������������������������������������������������������������������� 32

Administration and Team Development������������������������������������������������������������������������������������������������ 35

Summary������������������������������������������������������������������������������������������������������������������������ 36

■Chapter 3: Identifying the Problem and Designing the Solution�������������������������� 37

Identifying System Requirements ���������������������������������������������������������������������������������� 37

Never a Clean Slate ������������������������������������������������������������������������������������������������������������������������������ 37

A Broken System ���������������������������������������������������������������������������������������������������������������������������������� 38

How Do You Fix Things?������������������������������������������������������������������������������������������������������������������������ 38

System Design with APEX in Mind ��������������������������������������������������������������������������������� 40

Table Definition and User-Interface Defaults ���������������������������������������������������������������������������������������� 40

APEX and Primary Keys ������������������������������������������������������������������������������������������������������������������������ 41

Business Logic vs. User-Interface Logic����������������������������������������������������������������������������������������������� 41

Placement of Database Objects������������������������������������������������������������������������������������������������������������ 42

Translating Theory to Practice���������������������������������������������������������������������������������������� 42

Summary������������������������������������������������������������������������������������������������������������������������ 43

■Chapter 4: SQL Workshop������������������������������������������������������������������������������������ 45

Creating Objects with the Object Browser ��������������������������������������������������������������������� 45

Loading Data with the Data Workshop Utility ����������������������������������������������������������������� 52

Creating a Lookup Table������������������������������������������������������������������������������������������������� 57

Loading and Running SQL Scripts���������������������������������������������������������������������������������� 60

User Interface Defaults��������������������������������������������������������������������������������������������������� 64

Understanding User Interface Defaults������������������������������������������������������������������������������������������������� 64

Defining UI Defaults for Tables ������������������������������������������������������������������������������������������������������������� 64

Summary������������������������������������������������������������������������������������������������������������������������ 66

■Chapter 5: Applications and Navigation �������������������������������������������������������������� 67

The Create Application Wizard���������������������������������������������������������������������������������������� 67

Sample and Packaged Applications ����������������������������������������������������������������������������������������������������� 68

Websheet Applications ������������������������������������������������������������������������������������������������������������������������� 72

www.it-ebooks.info

ix

■ Contents

Database Applications from Spreadsheets������������������������������������������������������������������������������������������� 72

Applications from Scratch �������������������������������������������������������������������������������������������������������������������� 73

Static Content Regions��������������������������������������������������������������������������������������������������� 82

Public Pages������������������������������������������������������������������������������������������������������������������� 87

Navigation Bar Entries���������������������������������������������������������������������������������������������������� 88

Global Pages������������������������������������������������������������������������������������������������������������������� 91

Breadcrumb Regions������������������������������������������������������������������������������������������������������ 93

Breadcrumb Entries ������������������������������������������������������������������������������������������������������� 98

Lists�������������������������������������������������������������������������������������������������������������������������������� 99

Lists of Values ������������������������������������������������������������������������������������������������������������� 102

Static List of Values ���������������������������������������������������������������������������������������������������������������������������� 103

Dynamic List of Values������������������������������������������������������������������������������������������������������������������������ 104

Summary���������������������������������������������������������������������������������������������������������������������� 106

■Chapter 6: Forms and Reports: The Basics ������������������������������������������������������� 107

APEX Forms������������������������������������������������������������������������������������������������������������������ 107

Form on a Table������������������������������������������������������������������������������������������������������������ 109

Creating a Form on a Table����������������������������������������������������������������������������������������������������������������� 109

Modifying a Form on a Table �������������������������������������������������������������������������������������������������������������� 115

Looking Behind the Scenes ���������������������������������������������������������������������������������������������������������������� 120

Form on a Procedure���������������������������������������������������������������������������������������������������� 122

Creating a Form on a Procedure��������������������������������������������������������������������������������������������������������� 122

Modifying a Form on a Procedure ������������������������������������������������������������������������������������������������������ 125

Looking Behind the Scenes ���������������������������������������������������������������������������������������������������������������� 126

Master–Detail Report and Form����������������������������������������������������������������������������������� 127

Creating a Master–Detail Report and Form���������������������������������������������������������������������������������������� 127

Modifying a Master-Detail Report������������������������������������������������������������������������������������������������������� 132

Session State ��������������������������������������������������������������������������������������������������������������� 137

Understanding Session State ������������������������������������������������������������������������������������������������������������� 137

Sharing Database Connections����������������������������������������������������������������������������������������������������������� 138

www.it-ebooks.info

x

■ Contents

Setting and Retrieving Session State ������������������������������������������������������������������������������������������������� 139

Viewing Session State ������������������������������������������������������������������������������������������������������������������������ 140

APEX Items ������������������������������������������������������������������������������������������������������������������� 141

Page vs. Application Items������������������������������������������������������������������������������������������������������������������ 142

The Importance of Bind Variables������������������������������������������������������������������������������������������������������� 142

Built-In Items �������������������������������������������������������������������������������������������������������������������������������������� 143

APEX URL Syntax���������������������������������������������������������������������������������������������������������� 143

Searchable APEX Reports��������������������������������������������������������������������������������������������� 145

Creating a Searchable APEX Report���������������������������������������������������������������������������������������������������� 145

Adding Reset Pagination��������������������������������������������������������������������������������������������������������������������� 147

Looking Behind the Scenes—APEX Report���������������������������������������������������������������������������������������� 148

Looking Behind the Scenes—APEX Master–Detail Forms ����������������������������������������������������������������� 150

More on APEX Forms���������������������������������������������������������������������������������������������������� 152

Item Layout����������������������������������������������������������������������������������������������������������������������������������������� 152

Placing Multiple Items in the Same Row�������������������������������������������������������������������������������������������� 154

Implementing LOVs����������������������������������������������������������������������������������������������������������������������������� 156

Master–Detail Cleanup ����������������������������������������������������������������������������������������������������������������������� 159

APEX Help��������������������������������������������������������������������������������������������������������������������� 160

Adding a Help Text Region������������������������������������������������������������������������������������������������������������������ 161

Seeding Help Text������������������������������������������������������������������������������������������������������������������������������� 162

Declarative BLOBs�������������������������������������������������������������������������������������������������������� 163

Summary���������������������������������������������������������������������������������������������������������������������� 166

■Chapter 7: Forms and Reports: Advanced��������������������������������������������������������� 167

Tabular Forms �������������������������������������������������������������������������������������������������������������� 167

Creating a Tabular Form ��������������������������������������������������������������������������������������������������������������������� 167

Modifying a Tabular Form������������������������������������������������������������������������������������������������������������������� 172

Looking Behind the Scenes ���������������������������������������������������������������������������������������������������������������� 176

Interactive Reports ������������������������������������������������������������������������������������������������������� 177

Creating an Interactive Report������������������������������������������������������������������������������������������������������������ 177

Running an Interactive Report������������������������������������������������������������������������������������������������������������ 181

www.it-ebooks.info

xi

■ Contents

Restricting Functionality by Report ���������������������������������������������������������������������������������������������������� 182

Restricting Functionality by Column��������������������������������������������������������������������������������������������������� 184

Using the Column Heading Menu ������������������������������������������������������������������������������������������������������� 184

Searching by Column�������������������������������������������������������������������������������������������������������������������������� 185

Selecting Columns������������������������������������������������������������������������������������������������������������������������������ 188

Filtering ���������������������������������������������������������������������������������������������������������������������������������������������� 188

Sorting ������������������������������������������������������������������������������������������������������������������������������������������������ 191

Adding Breaks ������������������������������������������������������������������������������������������������������������������������������������ 191

Highlighting ���������������������������������������������������������������������������������������������������������������������������������������� 192

Computing Columns ��������������������������������������������������������������������������������������������������������������������������� 193

Adding Aggregates ����������������������������������������������������������������������������������������������������������������������������� 194

Adding Charts to Interactive Reports�������������������������������������������������������������������������������������������������� 194

Grouping ��������������������������������������������������������������������������������������������������������������������������������������������� 196

Pivot����������������������������������������������������������������������������������������������������������������������������������������������������197

Using Flashback ��������������������������������������������������������������������������������������������������������������������������������� 198

Saving an Interactive Report �������������������������������������������������������������������������������������������������������������� 198

Resetting an Interactive Report���������������������������������������������������������������������������������������������������������� 200

Getting Help���������������������������������������������������������������������������������������������������������������������������������������� 200

Adding a Subscription ������������������������������������������������������������������������������������������������������������������������ 201

Downloading��������������������������������������������������������������������������������������������������������������������������������������� 202

Modifying an Interactive Report ��������������������������������������������������������������������������������������������������������� 204

Looking Behind the Scenes ���������������������������������������������������������������������������������������������������������������� 212

Calendars ��������������������������������������������������������������������������������������������������������������������� 213

Understanding Calendar Types ����������������������������������������������������������������������������������������������������������� 214

Creating a Calendar���������������������������������������������������������������������������������������������������������������������������� 214

Looking Behind the Scenes ���������������������������������������������������������������������������������������������������������������� 222

Charts��������������������������������������������������������������������������������������������������������������������������� 222

Writing Queries for Charts ������������������������������������������������������������������������������������������������������������������ 223

Creating a Chart���������������������������������������������������������������������������������������������������������������������������������� 224

www.it-ebooks.info

xii

■ Contents

Filtering Data for a Chart �������������������������������������������������������������������������������������������������������������������� 226

Looking Behind the Scenes ���������������������������������������������������������������������������������������������������������������� 229

Summary���������������������������������������������������������������������������������������������������������������������� 229

■Chapter 8: Programmatic Elements ������������������������������������������������������������������ 231

Conditions �������������������������������������������������������������������������������������������������������������������� 231

Required Values������������������������������������������������������������������������������������������������������������ 231

Validations�������������������������������������������������������������������������������������������������������������������� 234

Item-Level Validation �������������������������������������������������������������������������������������������������������������������������� 234

Page-Level Validation ������������������������������������������������������������������������������������������������������������������������� 238

Tabular Form Validation���������������������������������������������������������������������������������������������������������������������� 240

Computations ��������������������������������������������������������������������������������������������������������������� 242

Execution�������������������������������������������������������������������������������������������������������������������������������������������� 242

Types �������������������������������������������������������������������������������������������������������������������������������������������������� 243

Creating a Computation���������������������������������������������������������������������������������������������������������������������� 243

Processes��������������������������������������������������������������������������������������������������������������������� 246

Execution Points ��������������������������������������������������������������������������������������������������������������������������������� 247

Process Types������������������������������������������������������������������������������������������������������������������������������������� 247

Processes in the Help Desk Application ��������������������������������������������������������������������������������������������� 248

PL/SQL Regions������������������������������������������������������������������������������������������������������������ 251

Dynamic SQL ���������������������������������������������������������������������������������������������������������������� 253

Summary���������������������������������������������������������������������������������������������������������������������� 258

■Chapter 9: Security�������������������������������������������������������������������������������������������� 259

User-Maintenance Navigation ������������������������������������������������������������������������������������� 259

User-Maintenance Data Entry �������������������������������������������������������������������������������������� 263

Authentication �������������������������������������������������������������������������������������������������������������� 269

Custom Authentication Schemes ��������������������������������������������������������������������������������� 270

Conditional Security ����������������������������������������������������������������������������������������������������� 272

Access Control ������������������������������������������������������������������������������������������������������������� 273

Authorization ���������������������������������������������������������������������������������������������������������������� 276

www.it-ebooks.info

xiii

■ Contents

Read-Only Items����������������������������������������������������������������������������������������������������������� 279

Data Security���������������������������������������������������������������������������������������������������������������� 281

Session-State Protection���������������������������������������������������������������������������������������������� 284

Summary���������������������������������������������������������������������������������������������������������������������� 285

■Chapter 10: Application Bundling and Deployment������������������������������������������� 287

Identifying Application Components����������������������������������������������������������������������������� 287

External Files�������������������������������������������������������������������������������������������������������������������������������������� 288

Database Objects�������������������������������������������������������������������������������������������������������������������������������� 288

APEX-Based Files ������������������������������������������������������������������������������������������������������������������������������� 294

APEX Application Exports�������������������������������������������������������������������������������������������������������������������� 296

Supporting Objects������������������������������������������������������������������������������������������������������� 299

Prerequisites��������������������������������������������������������������������������������������������������������������������������������������� 300

Substitutions��������������������������������������������������������������������������������������������������������������������������������������� 301

Build Options �������������������������������������������������������������������������������������������������������������������������������������� 301

Validations ������������������������������������������������������������������������������������������������������������������������������������������ 301

Install�������������������������������������������������������������������������������������������������������������������������������������������������� 301

Upgrade ���������������������������������������������������������������������������������������������������������������������������������������������� 303

Deinstall���������������������������������������������������������������������������������������������������������������������������������������������� 303

Export ������������������������������������������������������������������������������������������������������������������������������������������������� 303

Messages ������������������������������������������������������������������������������������������������������������������������������������������� 303

Importing���������������������������������������������������������������������������������������������������������������������� 304

Summary���������������������������������������������������������������������������������������������������������������������� 308

■Chapter 11: Understanding Websheets ������������������������������������������������������������� 309

Websheet Structure������������������������������������������������������������������������������������������������������ 309

Navigation �������������������������������������������������������������������������������������������������������������������� 311

Content Navigation ����������������������������������������������������������������������������������������������������������������������������� 311

Structural Navigation�������������������������������������������������������������������������������������������������������������������������� 313

Help ������������������������������������������������������������������������������������������������������������������������������ 313

Markup Syntax ������������������������������������������������������������������������������������������������������������� 315

www.it-ebooks.info

xiv

■ Contents

User Authentication������������������������������������������������������������������������������������������������������ 316

User Authorization�������������������������������������������������������������������������������������������������������� 318

Sections������������������������������������������������������������������������������������������������������������������������ 323

Text Sections �������������������������������������������������������������������������������������������������������������������������������������� 323

Navigation Sections���������������������������������������������������������������������������������������������������������������������������� 326

Data Sections ������������������������������������������������������������������������������������������������������������������������������������� 327

Chart Sections ������������������������������������������������������������������������������������������������������������������������������������ 337

Annotations ������������������������������������������������������������������������������������������������������������������ 337

Administration�������������������������������������������������������������������������������������������������������������� 338

Summary���������������������������������������������������������������������������������������������������������������������� 338

■Chapter 12: A Websheet Example���������������������������������������������������������������������� 339

Setup���������������������������������������������������������������������������������������������������������������������������� 339

Creating and Configuring a Websheet Application ������������������������������������������������������� 340

Adding Content to a Websheet ������������������������������������������������������������������������������������� 345

Creating Data Grids����������������������������������������������������������������������������������������������������������������������������� 345

Applying Constraints��������������������������������������������������������������������������������������������������������������������������� 347

Adding Players������������������������������������������������������������������������������������������������������������������������������������ 348

Creating Alternate Default Reports����������������������������������������������������������������������������������������������������� 349

Creating Page Sections ���������������������������������������������������������������������������������������������������������������������� 350

SQL Tags ��������������������������������������������������������������������������������������������������������������������������������������������� 357

Access Controls������������������������������������������������������������������������������������������������������������ 358

Summary���������������������������������������������������������������������������������������������������������������������� 358

■Chapter 13: Extended Developer Tools �������������������������������������������������������������� 359

Page Locks ������������������������������������������������������������������������������������������������������������������� 359

APEX Conflicts ������������������������������������������������������������������������������������������������������������������������������������ 360

Locking an APEX Page������������������������������������������������������������������������������������������������������������������������ 360

Unlocking a Page�������������������������������������������������������������������������������������������������������������������������������� 361

Administering Page Locks ������������������������������������������������������������������������������������������������������������������ 361

www.it-ebooks.info

Tải ngay đi em, còn do dự, trời tối mất!