Low Code Programming with APEX
Low Code Programming with APEX
Alenka Baggia
(University of Maribor, Faculty of Organizational Sciences)
Blaž Rodič
(Faculty of Information Studies)
Language editing Rachel McRae (Copy-Editor) and William McRae (Oracle Academy, Principal Instructor)
Jan Perša
(University of Maribor, University Press)
Marina Bajić
(University of Maribor, University Press)
Graphic material Source are own unless otherwise noted. Authors and Leskovar, Baggia (editors), 2024
Edition 1st
Available at https://press.um.si/index.php/ump/catalog/book/906
Project name Better Employability for Everyone with APEX - BeeAPEX
004.43(057.5)(0.034.2)
LOW code programming with APEX [Elektronski vir] : how to and practical cases / editors Robert Leskovar in
Alenka Baggia. - E-knjiga. - Maribor : University of Maribor, University Press, 2024
This book is published under a Creative Commons Attribution-ShareAlike 4.0 International licence (CC BY-SA 4.0). This license
allows reusers to distribute, remix, adapt, and build upon the material in any medium or format, so long as attribution is given to the
creator. The license allows for commercial use. If you remix, adapt, or build upon the material, you must license the modified
material under identical terms.
Any third-party material in this book is published under the book’s Creative Commons licence unless indicated otherwise in the
credit line to the material. If you would like to reuse any third-party material not covered by the book’s Creative Commons licence,
you will need to obtain permission directly from the copyright holder.
https://creativecommons.org/licenses/by-sa/4.0/
DOI https://doi.org/10.18690/um.fov.5.2024
Attribution Leskovar, R., Baggia, A. (eds.). (2024). Low Code Programming with APEX: How to and Practical
Cases. University of Maribor, University Press. doi: 10.18690/um.fov.5.2024
Contents
Acknowledgement 29
Preface 30
Contributors 33
IHow to in APEX 34
II
Constructing application in APEX 208
Bibliography 377
Articles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
. .
Books . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
. .
Index 378
List of Figures
11.1 Oracle APEX workspaces come with Sample Apps and Starter Apps. . . . . . . . . 184
.
11.2 Starter Apps in Gallery. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
.
11.3 Installation of starter app Team Calendar. . . . . . . . . . . . . . . . . . . . . . . 186
.
11.4 Sample Apps. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
. .
15.1 Use case diagram - GreenDi User Authorization and Management . . . . . . . . . 227
. .
15.2 Logical data model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
.
15.3 Relational data model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
.
15.4 User Form. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
.
15.5 User History Form. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
. .
20.1 Use case description: report and maintain basic data. . . . . . . . . . . . . . . . . 289
.
20.2 Use case description: report and maintain structure data. . . . . . . . . . . . . . . 290
.
20.3 Use case description: calculate BOM. . . . . . . . . . . . . . . . . . . . . . . . . 291
. .
21.1 Use case description: delete the particular recipe comment . . . . . . . . . . . . . 304
.
21.2 Use case description: compose the recipe . . . . . . . . . . . . . . . . . . . . . . 305
.
21.3 Use case description: add user comment on recipe . . . . . . . . . . . . . . . . . . 306
.
21.4 Use case description: prepare customised nutrition report on recipe . . . . . . . . . 307
. .
21.5 Requirements for pages and grants. . . . . . . . . . . . . . . . . . . . . . . . . . . 317
. .
24.1 Use case description: accessing cars, customers and car rent reservation . . . . . . 368
.
List of Links
: https://beeapex.eu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29
University of Maribor: https://www.um.si/en/home-page . . . . . . . . . . . . . . . . . .29
Faculty of Organizational Sciences,: https://fov.um.si/en . . . . . . . . . . . . . . . . . .29
University of Zagreb: http://www.unizg.hr/homepage . . . . . . . . . . . . . . . . . . . .29
Faculty of Organization and Informatics,: https://www.foi.unizg.hr/en . . . . . . . . . . .29
University of Žilina,: https://www.uniza.sk/index.php/en/ . . . . . . . . . . . . . . . . . .29
Kozminski University,: https://www.kozminski.edu.pl/en . . . . . . . . . . . . . . . . . .29
International Hellenic University: https://www.ihu.gr/en/enhome . . . . . . . . . . . . . .29
Johannes Kepler University: https://www.jku.at/en . . . . . . . . . . . . . . . . . . . . . .29
Oracle Academy: https://academy.oracle.com . . . . . . . . . . . . . . . . . . . . . . . .29
THE RIGHT THING SOLUTIONS: https://www.right-thing.solutions/ords/r/app/en/home 29
apex.oracle.com: https://apex.oracle.com . . . . . . . . . . . . . . . . . . . . . . . . . . .43
apex.oracle.com: https://apex.oracle.com . . . . . . . . . . . . . . . . . . . . . . . . . . .43
Free VirtualBox Appliance: https://www.oracle.com/database/technologies/databaseapp
dev-vm.html . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .43
Pre-Built Developer VMs: https://www.oracle.com/technetwork/community/developer-v
m/index.html . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .43
public BeeAPEX project page: https://beeapex.eu/course/view.php?id=12 . . . . . . . . 116 .
Oracle User Group in Netherlands: https://www.nloug.nl/ . . . . . . . . . . . . . . . . . 174 .
APEX Alpe Adria, Austria/Croatia/Slovenia: https://www.aaapeks.info/home/ . . . . . . 174 .
APEX Connect in Germany: https://apex.doag.org/ . . . . . . . . . . . . . . . . . . . . 174 .
APEX Community within Oracle Developer and Technology User in USA: https://www.
odtug.com/ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
.
SQL Developer: https://www.oracle.com/database/sqldeveloper/technologies/download/ 193 .
TOAD: https://www.toadworld.com/downloads . . . . . . . . . . . . . . . . . . . . . . 193 .
McKinsey’s DELTAs: https://www.mckinsey.com/industries/public-and-social-sector/
our-insights/defining-the-skills-citizens-will-need-in-the-future-world-of-work . . 194 .
public BeeAPEX project page: https://beeapex.eu/course/view.php?id=12 . . . . . . . . 200 .
public BeeAPEX project page: https://beeapex.eu/course/view.php?id=12 . . . . . . . . 216 .
public BeeAPEX project page: https://beeapex.eu/course/view.php?id=12 . . . . . . . . 223 .
public BeeAPEX project page: https://beeapex.eu/course/view.php?id=12 . . . . . . . . 230 .
public BeeAPEX project page: https://beeapex.eu/course/view.php?id=12 . . . . . . . . 239 .
Flows for APEX: https://flowsforapex.org/ . . . . . . . . . . . . . . . . . . . . . . . . . 243.
tutorials on Flows for APEX: https://flowsforapex.org/latest/getting-started/ . . . . . . . 243.
Flows zip file version 22: https://github.com/flowsforapex/apex-flowsforapex/releases/d
ownload/v22.2/FlowsforAPEX_v22.2.zip . . . . . . . . . . . . . . . . . . . . . . 245 .
Flows for APEX instructions: https://flowsforapex.org/latest/installation/ . . . . . . . . . 245
.
tutorials on Flows for APEX: https://flowsforapex.org/latest/getting-started/ . . . . . . . 245.
BPMN tutorial: https://flowsforapex.org/latest/tutorials . . . . . . . . . . . . . . . . . . 245
.
APEX integration tutorial: https://flowsforapex.org/assets/files/Tutorial_Flows_for_AP
EX_v22.2.zip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
.
28
Welcome to the exploring of Oracle Application Express (APEX) – an intuitive and powerful low-
code development platform for creating data-driven web applications. This textbook is designed to
equip you with the competences needed to harness the full potential of Oracle APEX and build
cutting-edge applications to address real-world business challenges.
Part I of this textbook is “How to”, dedicated to the fundamental aspects of Oracle APEX. In these
twelve chapters, you will embark on a journey to understand the core concepts, gain access to
APEX, and explore various functionalities to build robust applications. Each chapter delves into a
specific topic, providing clear instructions, and facilitating hands-on learning experience.
Chapter 1: “How to start Oracle APEX?” explains the fundamentals of what APEX is, along
with what it can be used for, before describing various ways to prepare the APEX environment for
a hands-on learning experience and application development.
Chapter 2: “How to prepare a database?” provides introduction to data modeling, managing
data base, manipulating data and querying data. For beginners a big picture understanding of data
base concepts is a must.
Chapter 3: “How to navigate in APEX?” gives a tour of APEX functionalities which enable the
development, generation and customization of different web pages and it’s components. Running
and testing the APEX application is just one tab away from development environment.
Chapter 4: “How to exchange data in APEX?” gives insight into importing and exporting data
within APEX. The chapter covers data exchange with files such as spreadsheets and also through
RESTful services.
Chapter 5: “How to generate a first draft of the application?” invites you to try the development
power of APEX. You will find that once you decide what your data is, you can immediately generate
appealing and functional application with no programming. It also how basic access control for end
users with different roles can be instantly generated.
Chapter 6: “How to manage reports?” guides you through delivering views of the data through
classic and interactive reporting wizards. APEX reports already include functionalities for end-user
customization of reports with no programming at all.
Chapter 7: “How to manage forms?” introduce you to three common types of web form
including master-detail. You will customize and generate form pages with no programming skills.
Chapter 8: “How to transform text reports into charts?” pave a path to utilize APEX capabilities
to present data as charts directly beside text reports.
31
Chapter 9: “How to manage menus?” presents types of various navigation elements for your
APEX application.
Chapter 10: “How to collaborate in a team?” offers insight into APEX functionalities which
serve teams since it is a rare situation that application development will involve only one developer.
Chapter 11: “How to benefit from a gallery of sample applications and plug-ins?” invites you
to apply powerful APEX capabilities through re-use of good patterns.
Chapter 12: “How to manage packaged and multilingual applications?” sets a path to distribute
your application to other APEX environments for users that speak different languages.
Part I also covers topics which are vital for application security, deployment strategies, and
readiness for the real-world.
Part II of this textbook takes you beyond the fundamentals, presenting twelve engaging business
cases which require you to solve a problem. Each case is carefully documented to provide a holistic
understanding of application development from a business, data and user interface perspective. This
part includes applications:
for businesses:
• intranet news for employees,
• small innovation system,
• business process management with workflows,
• bill of material calculation,
• book review system,
• nutrition and diet management,
• office hours scheduling,
• telecommunication company billing,
• car rental business
for communities:
• catalog of plants,
• exchange of plants.
and general applicable user authorization and management. In each business case, you will explore:
• Business view of the case: an overview of the business situation.
• Problem definition: A search to answer who and why someone has a headache.
• Use cases: Three types of description are presented: narrative, semi-structured and graphical
to prepare UML use case documentation.
• Logical and relational data model: APEX is fully featured to start fresh new data structures,
to use and modify existing ones, to combine with other data modeling tools and to support
forward or reverse engineering. Developers’ efforts to ensure appropriate chunks of data and
the relationships between and considering business needs are a foundation to proceed with
user interfaces.
• Application interfaces: textbook provides HTML pages, reports, forms, fields, menus, buttons,
hyperlinks which materializes the business situation, the solution to the business problem,
and the use cases and data with end-user in mind.
• Supplementary learning material: To enhance, accelerate and help you on the development
path you will find links to exported applications, scripts, data and video tutorials for each
chapter. These resources will provide you with practical insights, allowing you to reinforce
your knowledge and apply it directly to real-world projects.
Whether you are an experienced developer seeking to expand your skill-set or a beginner eager to
explore the world of APEX, this textbook is your definitive guide. Our hope is that also non-IT
learners will also find it an invaluable companion on the journey to mastering Oracle APEX and
building innovative applications that make a positive impacts.
32
The textbook and supplementary material are designed for approximately 75 hours of student effort
(3 ECTS). We hope that different modes of study can be applied through:
• teacher lead class lectures and lab exercises,
• blended learning and also
• self-paced study.
Depending on the learner’s background knowledge and available time to run the course, teachers
can easily assemble a set of chapters that suits the learning situations like: extracurricular courses,
summer schools, time limited events for low-code introductions for all students (not only in IT or
CS), and practitioners in various branches of industry.
APEX versions 22 and 23 were used for developing this textbook and supplementary learning
material. We believe that concepts and core technologies explained and applied in the contents will
be beneficial also to the learners of the future APEX versions.
Get ready to embark on an exciting learning adventure with Oracle APEX! Enjoy using wizards
and low-coding!
application development for accessing, unifying, analysing and displaying data from open data
sources and from corporate databases. Open data are freely available data for anyone to access,
use and share. They can be used without restrictions (or with some), shared with others or used to
create new works. They are made available by governments, companies and other organizations
to promote transparency and cooperation. Today there are many easily accessible sources of
meteorological, traffic, geological health and similar data, as well as statistics on education, health,
economy, etc. Corporate databases contain data on business transactions and other data that are
created as a result of business processes. Visualization, analysis, integration and different views of
this data can be used to make business decisions or achieve some other benefits. Oracle APEX is
used for prototype development, which is used to discuss what the program should do and show
the IT specialist what the user wants. The prototype reflects the essential features of the system.
Later, it is added to the system that will be used or serves as a basis for creating a system in another
programming language, tool, or platform.
Problem
Requirements
definition
(5.3)
(1.1)
Maintainance
Planning (1)
(5)
Objectives Business
(5.2) model (1.2)
Implementation
Design (2)
(4)
Construction
(3)
As shown in the figure, the application development cycle contains the following phases or
processes:
1. Planning (defining the problem and project)
• definition and analysis of the business model
1.1 What is Oracle APEX and what is it for? 37
• requirement specification
• determination of basic processes and data
• technology and architecture decisions
• development planning
2. Application design
• analysis and specification of requirements
• logical application design (use cases and logical data model)
3. Construction of the application
• database design
• development (prototype) of the application
• testing
4. Implementation of the application
The Planning is followed by Design, Construction and Implementation. These phases or
processes can be performed sequentially or iteratively (evolutionary, incremental), so that we go
through the entire development cycle several times and add a part of the functionality in each
iteration.
Application Planning The application development cycle begins with the Planning. With
simple applications, the initial information for the Planning of the application can be Problem
definition, document which clearly states the problem. Who has a headache? Why is this a real
headache? What is the manifestation of the problem? It can be a few sentences or pages of text. In
the case of complex business applications, detailed specifications should consider:
• Business view of the case describes how people inside organization perceive situations or
what they expect from the application.
• Objectives of the application development describe what the application wants to achieve
terms of business, technological and/or other factors, present as the indicators of success.
• Business model describes values, customer segments, customer relationships and channels,
key partners, activities and resources, structure and sources of revenues and costs, etc.
• Software requirements specification defines requirements regarding function, behavior, per-
formance, technology etc.
• The project plan describes the scope and phases of the future project, the activities (tasks)
that are performed in individual phases, the inputs and outputs of individual activities, the
resources that are needed, the interconnection of activities and their duration, costs, risks, etc.
There are methods for creating each of the listed specifications, which are described in the
literature. For example, Alexander Osterwalder [6] developed the Business Model Canvas method,
which is used to develop, improve and document new and existing business models As shown on
Figure 1.2, it is actually a visual chart of 9 building blocks that describe the value proposition
provided by the organization, its customers, relationships and channels with them, key partners,
activities and resources, as well as the cost structure and revenue streams.
While Business Model Canvas (BMC) serves to foster understanding, analysis and design of
the business model, and especially what needs to be supported by the application we develop, and
Software Requirements Specification (SRS) is a document that describes what the software will do
and how it will be expected to perform. SRS describes the functionality, performance and other
characteristics that the application must have in order to support the business model and needs of
all users.
Application Design From the first computers and computer programs to today, hundreds of
different methodological approaches, methods and techniques of application design have been
developed. The methodology of program design has changed with technological development. Low-
code / no-code program development is an approach that prefers simple methods, understandable
to users who are not professional software developers. However, application development requires
some design processes before program generation.
1.1 What is Oracle APEX and what is it for? 38
Cost structure: What are the most important Revenue stream: What are our sources of
costs and what are their drivers? income? What value are our customers
willing to pay and how much?
As we mentioned before, a computer application is a set of programs that work with data in
a database. To develop an application, we need to design both the programs and the database. If
the database already exists, we must know how to use it, and above all, understand the data model.
For the needs of low-code / no-code program development, we will introduce the most necessary
design methods. At the same time, the basis of the design is the creation of models that also have a
graphic representation. We will use the following methods:
• Use Case (UC) model that defines the relationship between the application and the environ-
ment.
• entity-relationship (ER) model that describes the structure of data at a logical level.
An
Use case will be explained in the continuation of this chapter, while entity-relationship (ER)
will be explained in Chapter 2.
which provides a standard way to visualize the design of a system. There is a rich literature UML
and the Object Management Group (OMG) takes care of its development and standardization.
UML contains 13 methods and diagrammatic techniques for modeling the structure, behavior and
interaction of software, and we will only utilize Use cases.
The Use case model consists of two parts:
• Specifications (narrative description) of use cases
• Use case diagram
First, we will study the Use Case diagram. This diagram describes what the system does,
from the point of view of an observer outside the system. It doesn’t matter how the system works
internally.
The basic concepts of the Use Case diagram are shown in Figure 1.3.
A use case represents a set of actions that can be performed by a system (e.g., a software
component) in interaction with external actors. It is a story that describes how actors use the system
to achieve certain goals or perform tasks. It represents an abstract task that has a purpose. The link
(Association) connects the participants in the communication, for example the actor and the use
case, and represents their interaction and the relationship between the system and the environment
(behaviour). An Actor represents a set of roles that interact with the system in the same way, for
example a user class, some kind of external system or similar. An actor is someone outside the
System under discussion who interacts with it but is not part of it. It can be a living being (User,
Patient, Pilot), or another system (Billing System, Bank, Carrier).
The diagram can also show the classification structure (see Figure 1.4), which explains the
generalization/specialization of the concepts, for example Actors. All subclasses (children) inherit
properties and behaviour from the superclass (parent), which means that they also inherit links to
use cases from the parent. At the same time, an individual subclass can enter a communication that
neither the superclass nor other subclasses enter into.
Figure 1.5 shows the boundaries of the system as a rectangle with the name of the system,
inside which the use cases are located.
UC diagrams do not show workflow or sequence of use cases. However, there are two allowed
types of associations between use cases which are also shown in Figure 1.5:
• "include" is an association from the base use case to the included use case, indicating that the
base use case contains the behavior of the included use case. In this way, the functionality
and behavior that is often used is separated into a use case that we will include as necessary
in other use cases. Note that the basic use case is not complete without inclusion.
• "extend" is an association from a use case that is an extension to a base use case, indicating
that the behavior of the base use case is extended by the behavior of the extension. At the
same time, the extension is not part of the basic use case, nor should this communication
always exist and function flawlessly.
The use of the aforementioned concepts of the Use cases diagram is best explained with
example, such as the Hotel Reservation system, shown in Figure 1.6.
The system whose behaviour we are observing is a Hotel Reservation. The system is all within
the boundaries shown by the rectangle. The surroundings of the system are outside the rectangle.
1.1 What is Oracle APEX and what is it for? 40
Within the system boundaries are six Use cases, shown by ellipses with names. Outside the system
are Actors, who communicate with the system, that is, its Use cases - this communication is
shown by connecting lines, and associations. Any User is an actor who communicates with Check
Availability. This Use case communicates with an external actor, Rooms DB. It is some kind of
external reservation system that has information about rooms and reservations in its database. Any
User can Book the room. This UC includes another UC, Update User. The classification structure
of the User actor is shown on the left. Agent, Receptionist and Guest are "a kind of actor" Any
user. In the case shown, only Guest can communicate with UCs Check In and Pay the bill. UC
Update User is included in Pay the bill, which means that user data can also be updated within the
bill payment functionality. UC Pay by card extends the Pay the bill functionality, this means that
card payment can be called up during bill payment. Pay by card communicates with an external
credit card payment service CC billing. Administrator can communicate with UC Update user and
update user information. As we already mentioned, the use case model consists of two parts:
• Specifications (narrative description) of use cases
• Use case diagram.
The Use Case specification describes scenarios and internal logic of Use Cases, initial states
(preconditions) and final states, interfaces, system messages, specification of error and exception
processing and similar. Usually, some kind of template is used for the Use Case specification, as
we will use in this book.
Construction, implementation and maintenance of the application The construction of the
application implies the creation of a program and the realization of a physical database. We will
use the Oracle APEX platform for this, as will be explained later in the book. The first version of
the application that works and can be tested is a prototype of the application. This prototype can be
upgraded and expanded. Considering what will happen with the prototype later, we distinguish
between two types of prototypes: throw away, and upgradeable. An upgradeable prototype is
improved and upgraded to a state that is suitable for use. Whilst the "throw away" prototype serves
as an illustration of the functionality and a model on which the application will be built, usually on
1.2 How to start Oracle APEX? 41
Figure 1.5: Boundaries of the system and associations "include" and "extend".
another platform. If we intend to use the application prototype, we must implement it - that means
install it in the production environment, educate users, prepare the database and similar.
The implementation phase is followed by the use of the and maintenance. These include fixing
and removing errors, improving performance and minor extensions of functionality. If major
changes are needed, a new development cycle of the application is started.
rience with procedures and functions in any database management system; intermediate
querying, inserting, updating and deleting; recommendation: use on-premise instance or
apex.oracle.com or Oracle Academy or VBox appliance or APEX docker
• On the road to professional developer: developing skills in PL/SQL and JavaScript; recom-
mendation: use on-premise instance or apex.oracle.com or APEX docker or OCI APEX
instance
Your user role and the location of Oracle APEX will determine how you log in and use the
application. Oracle APEX can be installed locally on your computer or in a hosted environment
like an Oracle Cloud service. Depending on the installation type, the sign-in procedure varies.
Users need to create a workspace, add Oracle APEX users, then sign in to the workspace before
developing or installing apps. Multiple users can collaborate on the same Oracle APEX installation
using a workspace while maintaining the privacy of their objects, data, and applications. If Web
browser supports JavaScript, users can log into a workspace to access the Oracle APEX home
page. Each workspace has a distinct name and ID. Within Oracle APEX Administration Services, a
workspace can be manually created by an instance administrator, or users can make requests. An
independent program called Oracle APEX Administration Services is used to oversee a complete
Oracle APEX instance.
enhances application security. Users can run production applications in an Oracle APEX
runtime environment, but it does not have a Web interface for administration. A runtime
environment is more secure because it just contains the components required to run the
program.
• Verify installation requirements. Verify whether your system satisfy the minimum re-
quirements for installation. There are five groups of requirements: a) Oracle Database
Requirements (Oracle APEX release 22 requires an Oracle Database release 12.1.0.2 or later.
Oracle APEX runs on all database editions, including Enterprise Edition (EE), Standard
Edition (SE) and Express Edition (XE). Oracle APEX can be installed in single-instance
database and in Oracle Real Application Clusters (Oracle RAC) database.), b) Browser
Requirements (Oracle APEX requires a JavaScript-enabled browser and supports the current
and prior major release of Google Chrome, Mozilla Firefox, Apple Safari, and Microsoft
Edge.), c) Web Listener Requirements (Oracle APEX requires Oracle REST Data Services
(ORDS) 19.x or later), d) Disk Space Requirements (Oracle APEX disk space requirements
310 MB free space for APEX software files on the file system if using English only download
and 705 MB if using full download, 220 MB free space in APEX tablespace, 100 MB free
space in SYSTEM tablespace, 60 MB free space in APEX tablespace for each additional
language (other than English) installed, e) Oracle XML DB Requirements (Oracle XML
DB must be installed in the Oracle database that you want to use if you are installing a full
development environment. If you are using a preconfigured database created either during an
installation or by Database Configuration Assistant or DBCA, Oracle XML DB is already
installed and configured.)
• Install the software. Install Oracle APEX by downloading a ZIP file from the Oracle APEX
page and then download and install Oracle REST Data Services (ORDS).
1.2.3 https://apex.oracle.com
Navigate your browser to apex.oracle.com. Requesting a free workspace is the fastest way to get
started with Oracle APEX. It only takes a few seconds to join up, and workspace is prepared for
users to begin developing apps. This approach doesn’t require a cloud account and it is free. To
start with Oracle APEX:
• Type in your web browser: apex.oracle.com
• Click on the Start for Free Today button
• On the web page that appears, select Request a free Workspace
• Put in your name, the e-mail address, give your workspace a name and click Next
• Complete the survey and put in why you are requesting workspace. Read through the terms
and conditions and accept the terms, click Next
• this point, you will get an email from the Oracle APEX, click on the link to register and
At
set up a password.
3. Third step is to open a terminal window and access the Oracle registry using the previously
created user.
It’s better to create a network in a docker environment so dockers can communicate with
other dockers using a hostname.
At this point, we have done all that we need and can execute the command to run our Oracle
Database XE in a docker on our laptop.
Note that the parameter name, hostname and network were used here. Explanation:
• The first flag -d will run the container in a detached mode.
• The parameter –name specifies the container name.
• -p maps the port 1521 on the host machine to the port 1521 in the container, so we can
connect to the database.
• –network connects the container to the network we created.
• –hostname give a name to the DB server.
• The last parameter is the image we want to use to spin up the container.
If you want to connect by sqlplus you can execute this command:
With the show pdbs command you will check the status of pdbs. Change the default password
using the below command (in this case the new password will be Welcome1!!). Before
execute this command please be sure the pdb XEPDB1 is open for read and write).
To set up APEX for Oracle XE installation in docker, perform further steps. From the
terminal session pull the image of ords.
mkdir ~/APEX
Note that the parameter hostname of Oracle Database XE docker and the service of the pdb
for the string connection were used. Define CONN_STRING variable as follows (needs to
be in below shape, without single quote):
CONN_STRING=user/password@host:port/service_name
The same parameter network was used here. To monitor the installation, you can open
another terminal session and execute this command:
docker run — rm — name apex
-v /Users/lbindi_it/APEX:/opt/oracle/variables
--network=ords-database-network -p 8181:8181
container-registry.oracle.com/database/ords:latest
Change the password for APEX_PUBLIC_USER user inside the database. To do that login
in a Oracle XE docker by sqlplus.
sqlplus sys/Welcome1##@//localhost:1521/XEPDB1 as sysdba
Now you can connect to APEX environment on your local computer with browser.
http://localhost:8181/ords
will change to a condition where it can only utilize OCI services that have a tiny Always Free
form available if you don’t upgrade before the trial expires. A minor Always Free shape is
there in APEX Service. Oracle advises that you convert your account to a paying one and buy
more credits either during or after the trial period. Begin the signup process, by reviewing
Oracle Cloud Infrastructure Free Tier. To start signup, go to https://signup.oraclecloud.com/.
2. Sign in to the OCI Console. Use a compatible web browser to find the OCI Console Sign-In
Page. Enter your login and password, followed by the name of your cloud account (also
known as your tenancy name). Your welcome email contains both your user name and cloud
account name.
1.3 Questions
1. What are the stages of application development cycle and what are activities of the third
stage?
2. Which of the possibilities to start with Oracle Application Express is the best solution for
absolute beginner?
3. What are benefits of using APEX instance in Oracle Cloud Infrastructure?
1.4 Answers
1. Stages of application development cycle are: (i) planning (defining the problem and project),
(ii) application design, (iii) construction of the application, (iv) Implementation of the
application. Activities of the third phase (construction of the application) are: database
design, development (prototype) of the application and testing.
2. Recommendation for absolute beginner is to use on-premise instance or apex.oracle.com or
Oracle Academy.
3. Oracle Cloud Infrastructure (OCI) offers APEX low-code application development on the
Autonomous Infrastructure as a fully managed service that is pre-configured and ready to
use. OCI provides elastic scalability, security, high availability and global access via regional
cloud data centres.
2. How to prepare a database?
Assume you work for Walmart and Database Systems (DBS) have not yet been invented. Assume
further, you are asked to implement a Web application that can store, retrieve, visualize and
further process every single sale in every of Walmart’s 10.500 stores along with information about
responsible departments, employees and their jobs which could be Petabytes of data. This task
becomes unmanageable due to numerous challenges:
• How many files and disks do you need for storage?
• How do you find and retrieve data?
• How do you ensure adequate response times?
• How do you allow modifications and concurrent access to the data?
• How do you prevent unauthorized access to the data?
If you would employ a DBS as the constituting backbone of your Web application (cf. Figure
2.1) those challenges get manageable since DBS provide the proper functionality to deal with them.
A DBS comprises:
2.1 How to Model the Data 49
1. the software to assist in managing and processing large collections of data which can be used
by a Web application, called Database Management Systems (DBMS)
2. the actual storage of the data itself, called database, which provides the DB-layer where the
Web application builds upon.
In the following, the main concepts needed for building up the DB-layer, i.e., developing a
DB, are discussed in more detail. Although, ultimately the goal is “creating appropriate DB tables,
storing data, manipulating and querying it”, there are some important concepts which first have to
be introduced in order to achieve this goal.
In particular, we will start in Section 2.1 with the process of modeling the data to be stored
by introducing two different abstraction levels , comprising the logical model and the physical
model in terms of the relational model1 . Further on, in Section 2.2, DBS-specific mechanisms and
tools for creating the data structure within the DBS are focused on, as prescribed by the modeling
process. Based on that, Section 2.3 deals with data storage and manipulation issues and Section
2.4 aims at discussing the querying of stored data. Finally, Section 2.5 provides a summary of all
options and the according tooling which is available in order to build up the DB-layer of a Web
application.
Throughout all these sections, a running example is employed, inspired by the Walmart use case
introduced above, emphasizing its Human Resource (HR) aspect in terms of employees, departments
and jobs - a standard example which has been used by ORACLE for demonstration purposes since
the first version of its DBS in 1979.
between entities .
Entities. An entity has a unique noun phrase assigned as its name and is visually represented
as a rounded rectangle. Plural and singular forms are used however recently singular forms are
preferable (and also standardized by ISO 11179-5) .
Attributes. Attributes are always associated with entities, i.e., they cannot exist independently.
In contrast to entities, an attribute is “atomic”, meaning that it cannot be further structured like an
entity, being represented as a singular noun phrase. For each attribute, a certain domain (aka. data
type) can be assigned, denoting the “nature” of the allowed values. The most common ones are
numerical (NUMERIC), character (VARCHAR) and date/time (DATE/TIME).
Besides characterizing an entity, certain attributes can serve to uniquely identify each instance
of an entity (e.g., a concrete employee or a concrete department). Such identifying attributes act
as a so-called “Primary Key (PK)”. For exampple, when descrining a department, some artificial
ID can be defined as PK (which should be numeric, e.g., a “departmentID”) or alternatively the
combination of existing attributes like “departmentName” and “location”, building up a so-called
“composite PK”. It is advisable to define a PK for each entity, since otherwise, entities with the
same name (e.g., employees or departments) cannot be easily distinguished when retrieving the
data. Thus, each value of a PK attribute has to be unique and of course, must exist.
Finally, it has to be mentioned that besides domains and PKs, also other so-called constraints
on data values can be specified for particular attributes, e.g., NOT NULL, i.e., “mandatory” in order
to require the existence of a value (e.g., for an attribute salary).
Relationship. Finally, a relationship associates (most commonly) two different entities, is
visually depicted by a line between the entities’ rectangles and named by a verb phrase above the
line. There are foremost three different kinds of relationships which are commonly used in practice,
distinguished by the number of entity instances which are allowed to be part in the relationship at
each end called its “cardinality” (thus representing another kind of constraint on data that can be
specified):
• One-to-Many (“1:N”): One entity instance can be related to many entity instances at the
“many-side” of the relationship (e.g., one department has many employees, i.e., a “haveEm-
ployees” relationship) and an entity on the “many-side” of the relationship (an employee)
can be related to one entity at the “one-side”(a department) only. Such a relationship is
called a “Source-Target” or “Parent-Child” relationship, the source entity at the “one-side”
acting as the “Parent” and the arbitrary number of target entities at the “many-side” acting as
its “Childs”. In the above example, department is the Parent and employees are the Child
entities.
• Many-to-Many (“M:N”): One source entity instance can be related to many target entity
instances and one target entity instance can be related to many source entity instances.
An example would be Employees having Jobs (i.e., a “haveJobs”-relationship), since an
employee can have more than one job over time and a certain job is probably held by many
employees. It should be noted that “M:N” relationship will always produce two “1:N”
relationships as we will progress in database modeling.
2.1 How to Model the Data 51
• One-to-One (“1:1”): Finally, one entity instance can also be related to a single entity
instance at the other end of the relationship, only and vice versa (e.g., a person “livesAt” a
particular address and this address is the address of this particular person, only). It has to
be noted, however, that this kind of relationship is being often favoured by a more compact
representation within one entity only (e.g., entity persons also cover address attributes like
“street” and “city”) and therefore not considered any further in this Chapter.
• Optionality: For each of these three different kinds of relationships, it is also possible to
specify, at each end for source and target, if the existence of at least 1 entity instance is
optional or not. For example, if a new department is founded, it could be that there are not yet
any employees hired for that department, i.e., the target of the “haveEmployees”-relationship
has to be defined as optional. This is also depicted by the dotted line in ODM.
Relationships are termed in ODM simply as “relations” which should not be confounded with
“relations” of the “relational model” which are in fact a synonym for “tables” (cf. Section 2.1.2).
Therefore, we further adhere to the more common term “relationship”.
GUI-Elements of ODM for Managing ER-Diagrams. The following Figures provide a first
impression of the most important GUI elements of the ODM. First, Figure 2.3 illustrates how
to define new entities and new relationships, as well as the visualization of the logical model in
form of a list view and a graphical view. Within the graphical view, the most important graphical
notations and symbols are annotated.
Figure 2.4 shows the dialogue for the definition of attributes, which can be opened by simply
double clicking on a certain entity.
Figure 2.5 shows the dialogue for the definition of relationships, which can be started by simply
double clicking on a certain line, representing the relationship.
way. Analogous to an entity, a table consists of a name, columns (resembling attributes), their data
types and further (optional) constraints. All tables make up the RDB-schema (cf. Figure 2.6). The
schema of a table is further on the “vehicle” in order to store the actual data, whereas each row
in a table is called “tuple” which consists of a collection of related data values stored within the
columns, thereby representing a real-world entity instance in terms of relational (tabular) data.
It is interesting to note that ODM allows you to automatically generate a RDB-Schema out
of the logical model in terms of tables, thus reflecting the entities of our logical model and all
attributes and constraints of each entity. This is done by using the “Engineer to Relational Model”
menu entry as depicted in Figure 2.7. The resulting RDB-Schema can be visualized graphically
using ER-diagram formalism, based on a more “table-oriented-notation” than the ER-diagram of
the logical model, showing now, e.g., also the data types of all attributes.
Now, let’s focus on our exemplary relational model depicted in Figure 2.8.
First of all, during the process of generating the relational model out of the logical model,
besides transforming existing entities and attributes into tables and corresponding columns, PK’s are
automatically added to each table and given a name (cf., e.g., “Departments_PK (departmentID)”.
In addition, the relationships between entities within the logical model are automatically represented
within the tables, using the so-called “Foreign-Key (FK)” concept in the following way:
• One-to-Many (1:N) Relationship: Within the table at the “Many-side” of the relationship
(i.e., the Child table), an additional attribute is introduced and declared as FK, acting as a kind
of reference to the values of the PK of the relation at the “One-side” (i.e., the Parent table). If
there is, e.g., an employee with PK ID 4711, then within the FK attribute of the associated
department, the value 4711 also has to be present. Consequently, the FK attribute is required
to have the same data type as the PK. In our example, a FK “Departments_departmentID”
2.1 How to Model the Data 53
our example, all three FKs need a NOT NULL constraint since (i) Employees have to be
associated to a certain Department (ii) as well as to at least one Job and (iii) a Job has to be
associated to at least one Employee.
GUI-Elements of ODM for Managing the RM. The following Figures give an overview of
the most important GUI elements of the ODM for managing the RDB-Schema which are quite
similar to those for managing the logical model. First, Figure 2.9 illustrates how to define new
tables and new FKs, as well as the visualization of the RM in form of a list view and a graphical
view. Within the graphical view, the most important graphical notations and symbols are annotated.
Figure 2.10 shows the dialogue for the definition of columns, which can be started by simply
double clicking on a certain table. Note that this dialogue largely resembles the dialogue for
managing attributes as already depicted in Figure 2.4.
RDB-Schema independent of Physical Storage Aspects. Although a RDB-schema based
on the relational model is already more concrete and DBS-specific than the logical model (e.g.,
“implementing” relationships based on the FK-concept) it has to be noted that it still hides the
complexity of the underlying storage mechanisms of the DBS (aka. “physical” level), e.g., how
many files are used in order to store the tables or on which servers the data is to be stored. Another
big benefit of this abstraction from the physical storage aspects is that new RDB-schemas can
be realized or existing ones changed without haven to care about the underlying physical data
organization.
Figure 2.7: Process for RDB-Schema Generation out of the Logical Model.
these are, to some extent, conflicting goals, there is a well-known concept available for RDBS in
terms of the so-called “normalization theory” which describes a systematic process of three steps
named “first normal form”, “second normal form” and “third normal form”, leading to improved
RDB-Schemas (cf. Figure 2.11 for an overview). In the following, these three normal forms are
described in more detail, using slight variations of our running example.
First Normal Form. The first normal form requires that each attribute of a table is “atomic”
meaning that neither (i) sub-structures are allowed (e.g., if, instead of our simple attribute “lo-
cationName”, an alternative attribute “location” would contain values about street, postal code,
city and country) nor (ii) multi-values are allowed (e.g., attribute “location” could also contain
several addresses of a certain department. Sub-structures within values can be eliminated by simply
representing the sub-structure with dedicated attributes (e.g., for each part of the address) and
multi-values by simply using an own tuple for each of the values (i.e., putting each address in a
separate row).
One main benefit of the first normal form is, that data queries can be more specific, since now,
e.g., each part of the address as well as each address tuple can be separately accessed.
Second Normal Form. The second normal form requires (i) that a table is in the first normal
form and (ii) in case of a composite PK, i.e., consisting of two or more attributes, all other non-PK
attribute values are uniquely identified by the whole composite PK only. For example, assume
that the table Departments contains a composite PK with the attributes “departmentName” and
“locationName”. This PK correctly determines the value of a non-PK attribute “annualRevenue”,
since we naturally assume that the value of “annualRevenue” depends on both, the department
2.1 How to Model the Data 56
and its location. The values of another non-PK attribute “locationAddress”, however, would
already depend on a part of the PK, namely the location’s name. In order to eliminate this partial
dependency, we have to split up the table Departments, factoring out the location information into a
separate table “Locations” and connect both tables via a FK.
One main benefit of the second normal form is that it prevents redundant data storage, since in
our case, a certain address is stored only once and can be reused by different departments. This
reduces not only storage space but foremost also prevents incorrect data, so-called “anomalies” if,
e.g., certain data manipulations are not processed on any duplicate data (e.g., in case of several
departments moving to another address, the address has only to be changed once). Finally, the good
thing is that having tables with non-composite PKs only (e.g., a numerical ID for each table), the
RDB-Schema “automatically” fulfills the second normal form, since partial dependencies cannot
exist.
Third Normal Form. The third normal form requires (i) that a table is in the second normal
form and (ii) that each non-PK attribute is uniquely identified by the PK only and not by any
other non-PK attribute, leading to transitive dependencies. For example, if the table Departments
would contain besides the PK employeeID and the locationName also a locationAddress, then
locationAdress would already be uniquely identified by locationName (if we assume that each
locationName is associated with a different address) which is not allowed by the third normal form.
2.2 How to Manage the RDBS-Schema – SQL-DDL 57
In order to eliminate this situation, location information has to be factored out into a separate table
Locations and connected via a corresponding FK to the Departments table.
The benefit is the same as already discussed for the second normal form – reducing redundancy
and thus potential anomalies in case of data manipulations.
called DML (Data Manipulation Language) which will be discussed in Section 2.3 and finally (iii)
statements for querying the data called DQL (Data Query Language), further dealt with in Section
2.4.
Five Options for Creating the Tables. According to the tooling provided by ORACLE, there
are five different options for creating tables, i.e., implementing an RDB-Schema (cf. also Figure
2.45 for an overview):
1. Automatic Table Generation using ODM. This is the option with the least effort, since
simply initiating an automatic generation of the tables by some button-clicks using ODM
would suffice (cf. Section 2.2.1).
2. Automatic Table Generation using Quick SQL. Another alternative would be to use some
kind of “shorthand-notation” for SQL, provided by ORACLES Quick SQL tool (cf. Section
2.2.2). This is the perfect choice if there are no graphical (logical and / or relational) models
of the RDB-Schema available or if some quick testing is necessary.
3. Manual Table Creation using SQL-DDL. There is of course, also the possibility to
ideogrammatically specify the tables using plain SQL, providing the benefits that every
single detail concerning the table specification can be configured as needed and being not
dependent on, sometimes sub-optimal automatic generation processes (cf. Section 2.2.3).
4. Manual Table Creation using ORACLE Object Browser (OB). For those users having no
SQL knowledge, the Object Browser allows to create new tables and alter them if necessary
in a form-based manner (cf. Section 2.2.4).
2.2 How to Manage the RDBS-Schema – SQL-DDL 59
5. Automatic Table Creation using ORACLE Data Workshop. Finally, there is another
automatic table creation possibility which can be, however, used only if there is already some
data stored within external files (e.g., within EXCEL-files) using ORACLE Data Workshop.
This option is not further dealt with in this Chapter but rather described in more detail in
chapter 4.
In the following, the first four options are discussed in more detail.
again the SQL Command Editor is used (cf. Figure 2.17) the same which was used for creating
tables and manipulating data.
(1) Let’s start with the simplest query – “Retrieve all Employees” (cf. Figure 2.29).
The target table of the query (Employees) is specified within the FROM-clause, the required
result of the query is defined right after the SELECT-clause - in this example using the star as a joker
sign – meaning we would like to get the values of all columns of the table.
An excerpt of the result of this query looks as follows (cf. Figure 2.30):
If we would like to order the result, e.g., according to the employee’s salaries, we have to simply
add an ORDER BY-clause (cf. Figure 2.31):
The result of this query looks as follows (cf. Figure 2.32):
(2) What about querying certain columns and certain rows only – “Retrieve name, address
and salary of employees having a salary higher than 5.000, only”
First, in order to get back the values of certain attributes only, we just have to specify them
instead of the star, separated by commas. Second, to selectively retrieve certain rows only, we need
to introduce a WHERE-clause and specify a logical condition on the corresponding attribute (salary
in our case). Note that, there can be several such conditions on different attributes, separated by the
keywords AND / OR (cf. Figure 2.33).
The result of this query looks as follows (cf. Figure 2.34):
If we would like to get the values of the “hireDate” attribute in another format, the TO_CHAR()-
function” provided by ORACLE SQL can be used. This function takes a DATE value as first input,
and a desired format as second input. In the following, an extended version of the above example is
shown (cf. Figure 2.35), now using the TO_CHAR()-function for “hiredate” (a full list of possible
formatting options is, of course, available in the Oracle documentation):
The result of this query looks as follows (cf. Figure 2.36):
(3) Let’s focus on querying several tables – “Retrieve all employees and their departments”
Retrieving the data of two or more tables within a single SELECT-statement requires a quite
prominent SQL-concept, i.e., a “Join”. A join combines, in fact, the rows from two or more tables
which have to be specified in the FROM-clause. Additionally, we need a WHERE-clause which plays
the role of a matchmaker between these two tables – since we have to somehow define that the
DBS should, for each employee in the Employees table, take its Departments_ departmentID value
(which is the FK), go further on to the Departments table, match this value with the according
PK value of departmentID and give back the departments data together with the employees data.
More formally, this matchmaking is specified by a so-called “join-condition” as can be seen in the
following example (cf. Figure 2.37):
The result of this query looks as follows (cf. Figure 2.38):
Note that the according join-attributes are also "qualified" using the according table names
(separated by a "dot"), thus striving for better readability and - in case the name of the FK would be
the same as the name of the PK - ensuring a unique identification.
(4) Let’s stick to aggregating values – “Retrieve the number of employees and the sum of their
salaries”
To retieve the number of all employees in the Table Employees we can use the SQL COUNT-
function over different employeeIDs. For building a sum of all values we can employ the SUM-
function over an attribute, in our case, as we want to calculate the sum of all salaries, the attribute
salary (cf. Figure 2.39):
The result of this query looks as follows (cf. Figure 2.40):
(5) Finally, what about grouping certain rows – “Retrieve the number of employees grouped
by their salaries in descending order”
To group same data together we can use the GROUP BY-function in an SELECT-statement.
Combined with a SQL COUNT-function over different employeeIDs we are now able to determine
the number of rows for each group. For sorting the result we can employ the ORDER BY-function
2.5 Building up the DB-Layer – The Big Picture 63
stating which attribute should be used for ordering. Thereby, ASC declares ascending order whereas
DESC declares a descending order (cf. Figure 2.41):
The result of this query looks as follows (cf. Figure 2.42):
2.6 Questions
1. What is the difference between a logical model and a relational model? What are the elements
of the two models?
2. What is the normalization of an RDB-Schema?
3. Describe the options for creating tables using the Oracle toolset.
2.7 Answers
1. The logical model is more abstract. The elements of the logical model are entities, attributes,
and relationships. The relational model represents a more concrete and therefore DBS-
specific level. The elements of the relational model are tables, table columns (data fields)
2.7 Answers 64
and relationships.
2. The normalization of a RDB-Schema is a systematic process with three steps called "first
normal form", "second normal form" and "third normal form", leading to improved RDB-
Schemas.
3. There are at least five ways to create the tables: automatic table generation with Oracle Data
Modeler, automatic table generation with Quick SQL in Oracle APEX, manual table creation
with SQL-DDL in Oracle APEX SQL Commands, manual table creation with Oracle APEX
Object Browser, and automatic table creation with Oracle APEX Data Workshop.
2.7 Answers 65
Figure 2.22: SQL Statement for Inserting new Data into Table Departments.
Figure 2.23: SQL Statement for Updating the Salary of all Employees in Table Employees.
Figure 2.24: SQL Statement for Updating the Salary of Employee "Miller", only.
Figure 2.25: SQL Statement for Updating more than one attribute in Table Employees.
2.7 Answers 70
Figure 2.26: SQL Statement for Deleting all Data from Table Employees.
Figure 2.27: SQL Statement for Deleting some Data from Table Employees.
Figure 2.29: SQL Statement for Retrieving all Data from Table Employees.
2.7 Answers 71
Figure 2.30: Excerpt from Retrieving all Data from Table EMPLOYEES.
Figure 2.31: SQL Statement for Retrieving all Data from Table Employees ordered by Salary.
Figure 2.32: Excerpt from Retrieving all Data from Table Employees ordered by their Salary.
Figure 2.33: SQL Statement for Retrieving certain Data from Table Employees only.
2.7 Answers 72
Figure 2.34: Excerpt from Retrieving certain Data from Table Employees only.
Figure 2.35: SQL Statement for Retrieving Data from Table Employees using TO_CHAR().
Figure 2.36: Excerpt from Retrieving Data from Table Employees using TO_CHAR()-Function.
Figure 2.37: SQL Statement for Joining Data from Table Employees and Table Departments.
2.7 Answers 73
Figure 2.38: Excerpt from Retrieving Data from Table Employees and Table Departments.
Figure 2.39: SQL Statement for Counting the number of Employees and Building the Sum of their
Salaries from Table Employees.
Figure 2.40: Excerpt from Retrieving the Number of Employees and Building the Sum of their
Salaries from Table Employees.
Figure 2.41: SQL Statement for Grouping the Data by Their Salary and Ordering the Result by the
Number of Employees with that Salary from Table Employees.
Figure 2.42: Excerpt from Grouping the Data by Their Salary and Ordering the Result by the
Number of Employees with that Salary from Table Employees
2.7 Answers 74
What is Oracle APEX? Oracle Application Express (Oracle APEX) is a Web browser-based
low-code development environment for Oracle DB-driven Web applications. “Low-code” means
that only few programming skills are required for building-up a full-fledged Web application – for
a first, simple Web application prototype, programming skills are not even necessary at all.
For Which Purposes can APEX be Used? Overall, APEX allows not only to build-up the
DB-layer of Web applications using APEX “SQL Workshop”, as has been discussed in Chapter
2, but also to build-up desktop or mobile Web applications using APEX “App Builder”. APEX
is employed by large and small customers alike, across a broad number of application domains,
coping with a wide spectrum of business needs. These business needs may range from a simple
transformation of a local spreadsheet into a Web-based one, to the realization of a full-fledged Web
application (cf. the running example introduced in Chapter 2) allowing to store, retrieve, visualize
and further process every single sale in every of Walmart’s 10.500 stores together with responsible
departments, employees, and information about their job.
What is the Rationale Behind this Chapter? The rationale behind this chapter is to first
discuss the overall Web application development process followed by Oracle APEXs “App Builder”.
This process forms the basis for the navigation possibilities between the different App Builder
tools called “development components” in order to build up a Web application. Second, a rather
high-level overview of these different development components is given, whereas details will be
discussed in the further chapters.
APEX focuses on the development of DB-driven Web applications, it is necessary to always start by
developing the DB-layer first (cf. Figure 3.1 "STEP 1: REUSE APP | TABLES | DATA") . This can
be done either as described in Chapter 2 or directly within the App Builder, if, e.g., some external
data files already exist, which can be reused for creating the DB tables (cf. Figure 3.1 “From a
File”). In case that the DB tables already exist, the development process can either be started (i)
from within the App Builder, thereby eventually reusing (and adapting) an existing application
together with its DB tables (cf. Figure 3.1 "Starter App") or by creating a new application from
scratch, again based on existing DB tables (cf. Figure 3.1 "New Application") or (ii) from within
SQL Workshop, by simply selecting a DB table within the Object Browser (cf. Figure 3.1 "Select
TABLE") and starting the application development process on basis of this table.
APEX Follows a “Page-Driven” Development Process. As soon as the DB tables for storing
the data of the Web application exist, they can be used for creating a new Web application, following
a page-driven process (cf. Figure 3.1 "STEP 2: SPECIFY PAGES"). This means that one or more
Web pages can be defined, making up the HTML-pages of the final Web application. Each of
these pages can be based on one or more DB tables, allowing to visualize their data in terms of
different page types comprising, e.g., interactive reports, forms, lists, charts or calendars, but also
to interactively “play” with the data (e.g., zoom into details), and even to manipulate them, and
store the changes back into the DB. These pages can be linked together using navigation menus,
tabs, buttons, or hypertext links.
As soon as one or more pages have been created, it is necessary to create the overall application
(cf. Figure 3.1 "STEP 3: CREATE APP"), thereby further specifying some overall properties of the
whole Web application (e.g., appearance of the App) or just using the default settings. Finally, the
App and/or each of the specified pages has to be rendered in order to generate the final HTML-pages
(Figure 3.1 "STEP: 4 RUN"), which can further on be interactively tested, occasionally stepping
back to further refine the Web application.
• “Team Development” is used, e.g., to interact with other developers via a ticketing system to
set milestones, etc.
• “Gallery” is used to simply install pre-built demo applications, which can then be further
modified and adapted towards own needs, again using the “App Builder”.
At the bottom of the Workspace Homepage (cf. Figure 3.2), the regions “Top Apps”, “Top
Users”, and “Summary” offer real time information about development activities in the current DB
workspace, whereas at the right-hand side further APEX learning resources are referenced.
3.3 Overview of the App Builder – Create and Manage your Apps
When navigating to the App Builder Homepage, one has the following options (cf. Figure 3.3):
• Create a new Web application.
• Import previously exported Web applications.
• View the "Dashboard" providing statistics on already developed Web applications.
• Access "Workspace Utilities" providing a wide range of services like remote data access or
backup functionality.
In the bottom half of the window (cf. Figure 3.3), already existing Web applications are listed
which can be selected for further editing or rendering (cf. forthcoming sections).
In the following, the focus will be on the first option “New Application”, the second option “From
a File” will be described in more detail in Chapter 4, the third option "Starter App" will not be
further dealt with.
Figure 3.4: Create Application Wizard: Three Use Cases when Creating an Application.
3.9 Questions
1. What options does the application creation wizard provide and what are they used for?
3.10 Answers 83
3.10 Answers
1. There are three options: a) "New Application" allows the developer to add pages for existing
data, select application features, set the theme and configure it, b) "From a File" allows the
developer to upload files in formats such as CSV, XLSX, XML and JSON or copy/paste data
and initiate the creation of the application and c) "Starter App" allows the developer to install
one or many Sample and Starter Apps from Gallery.
2. There are several useful features such as automatic creation of an "About Page", providing
application administrator a page to grant privileges to users in the "Access Control" feature,
automatic creation of a "User Feedback" page, activity reporting, theme style selection,
configuration options, and the choice of installing a progressive web application.
3. APEX can generate a wide range of pages: form, report (interactive grid, interactive report,
classic report, master detail), blank page, calendar, cards, chart, dashboard, faceted search,
smart filter, map, search page, plug-in page, tree, data loading, wizard and unified task list.
3.10 Answers 84
The major task when building up the DB-layer for a Web application is the creation of the DB-tables
and the insertion of appropriate data (see Chapter 2). This can, however, not only be done manually
if the data does not yet exist. In the case there is already existing data available within external files
it can simply be reused and imported into the Oracle DB. At the same time, it could be desirable
to export already existing data into a file from time to time, so that it can be reused in a second
step by some other, external application. And finally, in case that some external clients (e.g., other
Web/mobile/legacy applications or cloud-based services) should be provided with online access to
the data within our DB, instead of just exchanging data files from time to time, there is also the
possibility of providing indirect online access to our DB data.
These three use cases for data exchange are illustrated in Figure 4.1, providing a summary of
the different options Oracle APEX provides for importing, exporting and indirectly accessing DB
data. This chapter is intended to give an overview about these different options.
Figure 4.2: Using Data Workshop to Load Data - Access through SQL Workshop.
3. Settings for Delimited Files. The setting section (cf. Figure 4.5 (3)) allows for three
different important configurations specific to delimited (“CSV”) files. The configuration
option “Column Headers” allows to specify if the first row of the data contains the column
names. The “Column Delimiter” can be freely chosen as can be seen in the “Settings”-section
of Figure 4.5 (3) enabling Oracle to extract the structure out of the external file – a process
which is called ”parsing”, being the prerequisite to map the data into the table. Through the
setting “Enclosed by”, the starting and ending boundary of a data value can be delineated. If
you specify a delimiter character, Data Workshop ignores white-space occurring before the
starting and ending boundary of a data value. You can also use this option to enclose a data
value with the specified delimiter character.
4. Sample Preview for Parsed Data. Oracle automatically parses the data, as already men-
tioned, in order to extract the structure of the data, thereby also detecting, e.g., appropriate
data types. At the bottom of Figure 4.5 (4), a small sample (up to 10 columns and 5 rows) of
the result of this parsing process is shown.
4.1 Importing and Exporting Data Using “Data Workshop” 92
Figure 4.3: Using Data Workshop to Load Data - Access through App Builder.
into the new or the existing table, whereby the loading dialog informs how many rows have
been loaded. The process of data loading runs in the background which is beneficial if a
larger file is being uploaded, since the dialog can be dismissed. During this loading process,
it could also be the case, that there are some erroneous rows encountered, which cannot be
inserted into the target table, since, e.g., the one or the other value is conflicting with some
data type. In this case, these erroneous rows are automatically saved in an error table and
can be post-processed manually. One gets also informed by the loading dialog about eventual
erroneous rows. The resulting table (and an eventual error table) can now be viewed by
navigating to the “Object Browser” or it can be immediately continued with the development
of the Web application.
respective table has to be selected (cf. Figure 4.9 (1)). If now data should be imported, after clicking
the "Load Data-button", the same dialog appears as when selecting "Load Data" (cf. Figure 4.9 (2),
(3)) as already described in Section 4.1.1 - also the same file formats are supported. At the other
hand-side, the export of data can be simply done by clicking the “Download-button" at the bottom
of the page, leading to the immediate generation of a CSV file containing the data of the DB-table.
and the automatically generated access URL appears (4). Again, this REST-service can be simply
tested by entering the URL in a Web browser (6).
4.6 Questions
1. What are the use cases for importing data via SQL Workshop and App Builder?
2. What are the different ways to export data?
3. What is REST for ? What is its purpose or benefit?
4.7 Answers
1. Data Workshop allows importing data from external files via a "Wizard" and importing data
into a table via the "Object Browser". Data import from Data Workshop can also be initiated
via App Builder.
2. Exporting data to a file in a table-wise manner is supported by SQL Workshop’s "Object
Browser". Data Workshop provides an "Export Wizard" that allows to select the file format
and the tables as well as the corresponding columns whose data should be exported.
3. RESTful services provide interoperability between any systems over the Internet by allowing
data to be queried and manipulated.
4.7 Answers 98
Figure 4.14: Relationships Between the Different Components of ORDS RESTful Services.
4.7 Answers 105
Step 2: Click on the Request a Workspace button. In the pop-up window that appears, fill in
the required fields for identification and click on Next. Then, respond to the survey questions in the
next pop-up window and click on Next, as shown in Figure 5.2.
Step 3: Reply to the information requested for the justification and click on Next. In the next
pop-up, read the terms of the agreement and then proceed to accept them by clicking on Next. In
the following pop-up, check the details you have entered for any errors, and then click on Submit
request as shown in Figure 5.3.
Step 4: Once you have submitted the request, a pop-up window will appear, confirming that
your workspace has been requested and an activation email will be sent to the email address you
have provided, as shown in Figure 5.4.
Step 5: Check your email for a message from APEX. Your request needs to be approved before
you can proceed. Once approved, click on Create Workspace as shown in Figure 5.5.
Step 6: Wait until the Workspace creation process is completed. Once completed, a pop-up
window will inform you that the Workspace has been successfully created. Click on Continue to
Sign-in Screen. A new pop-up window will appear, asking you to change your password before
logging in. Set a new password, confirm it, and click on Change Password, as shown in Figure 5.6.
Step 7: The Oracle APEX environment is now ready to be used, as shown in Figure 5.7.
According to the relational model derived from the logical model using Oracle Data Modeler
(ODM), as depicted in Figure 5.9, we can proceed with implementing the following structure in the
database.
ch05_departments /insert 5
dept_name vc100
ch05_projects /insert 15
proj_name vc100
budget num
begin_date date
end_date date
ch05_employees /insert 50
first_name vc20
last_name vc20
father_name vc20
birth_date date
hire_date date
id_card vc10
address vc100
5.3 SQL workshop example development 110
city vc20
vat_no vc10
telephone vc20
mobile vc20
salary num
dept num /fk ch05_departments
manager num /fk ch05_employees
These instructions provide a schema and sample data generation plan for a database, related to
departments, projects, employees, and their associations.
5.3 SQL workshop example development 111
-- create tables
create table ch05_departments (
id number generated by default on null as identity
constraint ch05_departments_id_pk primary key,
dept_name varchar2(100 char)
)
;
-- table index
create index ch05_employees_i1 on ch05_employees (dept);
create index ch05_employees_i62 on ch05_employees (manager);
-- table index
create index ch05_emp_proj_i1 on ch05_emp_proj (emp);
create index ch05_emp_proj_i112 on ch05_emp_proj (proj);
The ch05_departments table stores information about departments, including a unique identifier
(id) and a name (dept_name). The ch05_employees table stores information about employees, in-
cluding a unique identifier (id), first_name, last_name, father_name, birth_date, hire_date, ID_card
number, address, city, VAT_number, telephone number, mobile number, salary, and department
(dept) and manager (manager) IDs. The ch05_projects table stores information about projects,
including a unique identifier (id), name, budget, start_date, and end_ date. The ch05_emp_proj
table stores information about employee project relationships, including a unique identifier (id),
employee (emp) and project (proj) IDs, start_date, end_date, and earnings.
Indexes are created on the ch05_emp_proj table for the employee and project columns to
improve performance when querying the table based on those columns. Indexes are also created on
the ch05_employee table for the department and manager columns for the same reason.
5.4 Data driven part of application 114
Finally, constraints are added to ensure data consistency and referential integrity between
the tables. The ch05_emp_proj_emp_fk and ch05_emp_proj_proj_fk constraints ensure that
the employee and project columns in the ch05_emp_proj table reference valid id values in the
ch05_employees and ch05_project tables respectively.
The ch05_employees_dept_fk and ch05_employee_manager_fk constraints ensure that the
departure and manager columns in the ch05_employee table reference valid id values in the
ch05_departments and ch05_employees tables, respectively.
Additionally, the ON DELETE CASCADE clause specifies that if a row in the referenced table
is deleted, all related rows in the referencing table will be deleted as well, to maintain referential
integrity.
Step 2: To initiate the desired action, please refer to Figure 5.11 and click on the Run Now
button.
Step 3: Once all statements have been processed successfully without encountering any errors,
please proceed to Figure 5.12 and click on the Create App button.
and present your data according to your specific needs and preferences.
• Verify that you can view the existing Employees’ information, but you cannot make any
changes.
These steps confirm that the access control configurations have been successfully applied to the
users.
5.8 Questions
1. How many ways are there to create a new application in ORACLE APEX application Builder?
2. How can you add users to the application
3. How many built-in user privileges are there in ORACLE APEX for access control to an
application or its components?
5.9 Answers
1. There are 3 ways
• New Application
• From a File
• Starter app
2. Navigate to application workspace environment and choose Manage Users and Group
3. There are three
• Administrator
• Contributor
• Reader
5.9 Answers 117
The data in the databases are often meaningless if we do not get outputs from them that told us
more about their real information that they contain. To represent the results, observe and find out,
we just use reports, which we will deal with in the following chapter. We will learn how to easily
create such a report in the APEX environment and how to edit it. We will deal with different types
of reports such as interactive reports, classic reports, Column Toggle Report or reports with graphs
visualizations.
6.1 Report
Report is a region which simplifies data browsing and displays data in rows. It can figure as one
unit or it can be used to divide pages into logical units. It can be static, with only title and formatting,
but without any additional functionality. Or it can be a dynamic region, having specific functionality
like calendar, report or list. These regions are pre-programmed with its basic functionality that can
be also edited easily by users.
As you can see in Figure 6.1 when creating a page, users can select from pre-built page types
which already contain reports, so it is not necessary to insert a region by individual user. An
example of the form for report creation is shown in Figure 6.2. When creating a page containing a
report, it is necessary to fill in name of the page and data source of the page. Data can be loaded
from local database, REST enabled SQL or REST source. When selecting a local database option,
it is necessary to select what exactly would be used as a reports source - the user can not only use
the database table itself but also existing views or own SQL query statements.
When the page is created, a section similar to the one in Figure 6.3 appears on the left side. In
the side navbar you can see page, its name and all its components. After clicking on one of the
components it gets highlighted. After that you can see columns it contains, and also its sub-regions
or items. With the right click you can create a new empty region.
In the Figure 6.4 you can see the region and its attribute details. Identification defines page the
title and type of report (e.g., classic report). Figure 6.5 depicts several examples of source section in
which the source of data for our report as well as information about data origin (as mentioned above:
table, view, function or SQL query) are defined. Where Clause speaks about which condition will
be applied for data filtering.
In Figure 6.6 you can see Layout where you can specify region location within the page. Parent
6.1 Report 129
Region is to specify which region would contain our report. You can also adjust this via Position.
Positions are defined by the specific page template. After creating the page, it is built with specific
theme and layout depending on chosen template. Default template for theme Universal is called
Standard.
Regions are organized in a grid - so, every region has its own location defined by row and
column. These regions are organized by its sequence number. First region is in first row and first
column of the grid. Every next region is then organized by one of these patterns: in same row and
column as previous region, and it is displayed under the previous region. Attributes Start New
Row and New Column are used for specifying the way of organization for these regions.
Size and location are calculated after assignment of row and column. This is accomplished by
calculating occupation and width for every part of the row by values of parameters Column and
Column Span.
Indentation of area in its row is defined by attribute Column. Value of this column is in range 1
- 12 which refers to 1 of 12 points of the grid which split the width. Value 1 stands for the most left
part and 7 is for middle of the page.
In Figure 6.7 you can see the Appearance section which is used to edit the template for
specified region. Figure 6.8 shows pre-defined templates which the user can select from. Every
template can be customized by clicking on template options or by writing your own CSS statements.
In template options you can define multiple rules like body height, header visibility or even distance
between items.
Figure 6.9 shows a section named Advanced, where you can choose from four options. Static
ID is dedicated for setting up identifier of report. This Static ID is used as ID for HTML element
within the page for situations when user wants to configure the page appearance using CSS. Custom
Attributes are for additional information for HTML element. Custom attributes are stored as
name/value, for example: name = ”MY _REPORT ”
Region Display Selector is a component of region which provides navigation controls for other
regions within the page. Exclude Title from Translation avoids the title from translation in case
6.1 Report 130
region exists its default template, which is provided when you put it in. All necessary settings are
already set up.
As you can see on the left side of the page in Figure 6.17, APEX creates some components for
report by default. Each component represents one column, and it is possible to alter it in the same
way as you do with report.
Column settings are shown in Figure 6.19. In the Identification you can see two features -
Type and Name of Column. It is unable to change Name of Column, because its value is obtained
from the SQL query. Type of Column shown in Figure 6.18 determines how the column will be
displayed - to point out some of them: Hidden (nothing is displayed), Plain Text, Display Image,
Percent Graph and so on. By default, all columns are marked as Plain Text.
Heading consists of two options about header. Contrary to column name, the Heading (name)
can be edited. Header can also contain HTML code. The Alignment option speaks about itself.
Layout section offers Sequence, which determines in which order columns will be provided and
also Alignment option, same as in the previous section.
Last crucial part is Appearance, which should be edited, when you want to treat a number as a
string in some special format. As you can see in Figure 6.20, you can choose from plenty of basic
formats when you click on Format Mask. These formats are offered by APEX itself, but you can
express your own format if you want.
click on the Magnifying Glass, which is where we select which columns should be displayed, and
then click on the Go Button. We will see those records that contain the search string.
For example, we want to search for records that contain the number "730123/9403" in any
column. This filter will be displayed, and it can be turned off by clicking on the X Button. The
situation is shown in Figure 6.28. We can have multiple filters active at the same time on different
columns.
The Actions Button offers more possibilities to adjust display of the report. After clicking, a
sub-menu containing several items will appear. The listed items are shown in Figure 6.29.
Button Columns will show us a box that you can see in Figure 6.30. Here, the user can choose
which columns will be displayed in the report and also the order in which they should be displayed.
Users can achieve this by moving columns between two sections Do not Display and Display in
Report. There are helpful arrows, that easify work with moving of columns.
As another option, we have a Filter shown in Figure 6.31. We can filter values in column by
expressions like to be equal to, not equal, is null, etc. You can define expression by choosing from
predefined, or by writing your own.
In case of filtering rows, we have a choice of countless operations and expressions that we can
6.4 Interactive Report 134
compose. This filter appears in the Filter Expression window depicted in Figure 6.32.
After clicking on the Data button, the menu shown in Figure 6.33 will appear. The menu
contains another four possibilities:
• sort,
• aggregate,
• compute,
• flashback.
In Figure 6.34 you can see Sort option which can be applied on each column and user can
determine how to work with null values.
With Aggregate we can perform an aggregation function above one of the columns of our
report. The aggregation functions that we can choose from are shown in Figure 6.35.
Flashback function depicted in Figure 6.36 allows us to return to state of displayed report
before changes a few minutes ago.
Control Break shown in Figure 6.37 allows us to divide the report into several smaller units,
as if they were separate reports. These small units are divided depending on column values. Each
unit shares the same data in the selected column.
Figure 6.38 shows us control break applied on the First Name column.
In Figure 6.39 you can see the Highlight function that easily makes the records in the report
transparent, without filtering out the others. We can highlight either one cell or the entire row with
the colors we choose. Comparing the column value works the same as with the Filter, except that
unfiltered records do not disappear from the report.
In Figure 6.40 we can see the report with highlighted rows, with first name equal to "Aaban".
Figure 6.41 show Rows Per Page which is an attribute, where the user can choose how many
6.5 Questions 135
6.5 Questions
1. What category does the report type belong to? Regions, items or buttons?
2. What can be the data source for a Report?
3. What source types can be used for specifying Classic Report?
4. What is the main feature of the Classic Report?
5. Which technology allows user getting the data image as it existed in the past using Interactive
Report?
6.6 Answers 136
6.6 Answers
1. Report is a region simplifying data browsing and searching.
2. Data can be loaded from local database, REST enabled SQL or REST source.
3. Available source types are Table or SQL query.
4. The main feature of the Classic Report is the read-only mode, disallowing user to modify the
displaying options or data.
5. Flashback functions allow user to construct data image as it existed at defined timepoint.
6.6 Answers 137
Data can be searched using the text in the search bar at the top of the page. Other actions
available with this interactive grid are shown in Figure 7.2.
7.3 Form on a Table 149
It is possible to resize a grid column by clicking and holding the edge of a column heading and
adjusting it with the mouse. You can also hide a column by selecting the header and clicking the
Hide icon, as shown in Figure 7.3.
After hiding the column, it is no longer displayed in the grid. To view the column again, you
have to click on the Actions, choose the Columns option, and click on the columns to be displayed.
A column can be frozen after clicking the Freeze icon, as shown in Figure 7.5. Freezing a
column excludes it from the scrollable area.
Data can be sorted according to a column by selecting the Sort Ascending or Sort Descending
icon, as shown in Figure 7.6.
Using the Aggregate icon of the column, as shown in Figure 7.7, it is possible to choose from
Count, Count Distinct, Minimum and Maximum functions on the selected column.
Data from the grid can be used to create charts, choosing Actions and then Charts options. There
are various types of charts, as shown in Figure 7.8. You can choose from a variety of aggregation
functions provided with the charts.
7.5 Questions
1. Is it possible to arrange the data using Editable Interactive Grid?
2. Which table component definition must be selected, when creating a Form?
3. Which option excludes a column from a scrollable area?
7.6 Answers
1. Yes, the reports can be customized and rearranged interactively using the mouse, directly
updating a grid´s structure and contents.
2. Primary key attributes must be specified.
3. A column can be frozen after clicking the Freeze icon. Freezing a column excludes it from
the scrollable area.
7.6 Answers 152
Figure 7.11: Side by Side master detail form of Customer Flat Rates
7.6 Answers 154
8.1 Chart
Chart regions in Oracle APEX are versatile components that empower developers and users alike to
gain deeper insights from data through visual representation. These dynamic charts, ranging from
bar charts and line charts to pie charts and more, serve as important assets in enhancing the user
experience and facilitating data-driven decision-making.
In this chapter, you will learn how to create a simple chart with filtering and sorting capabilities.
Filtering and sorting can dramatically improve interactivity and the readability of charts. For
this purpose, we have created a simple data model as shown in Figure 8.1. The data model
consists of two entities: “product” and “sale_transaction”. The entity “product” represents a
single product, with its primary key attribute as “product_id”, and the product’s name stored in
the “product_name” attribute. The entity “sale_transaction” stores information about all our
sold products with the primary key “sale_id”. The “product_id” attribute is a foreign key that
references the “product_id” attribute in the “product” entity. The “sell_date” attribute contains
the date the product was sold.
To begin, it is necessary to create a new application, which we will call “Chart Showcase”.
This application will contain the “Global Page”, “Home” and “Login Page”. We will be creating
charts on the home page. Detailed instructions for creating applications were described in Chapter
5. After creating the application, enter the Page Designer for the “Home” page within our newly
created application.
8.2 Creating Bar Chart 156
We will place the Chart region in the body section of our page because we want our graph to
be the main content of the page. We will set the title of our newly placed Chart region to “Sales
Chart”. In Figure 8.3, you can see how our layout body section looks after placing and changing
the title of our Chart region.
In the left part of Page Designer, you can see the tree overview of all of our placed components.
If you look closely at our Sales Chart component, inside “Series”, it shows an error. This error, as
seen in Figure 8.4, is caused because we haven’t defined the source for our data that we want to
display in our graph.
When you click on the series labelled as “New” from the tree overview, the settings menu
for the series will open on the right side of Page Designer. Inside this settings menu, we will
change the name of the series to “sales” because we want to show the sales count of our individual
products in our Sales Chart. Next, we need to define the series source. To do that, we will change
the source type to “SQL Query” and inside the SQL Query, we will place a SELECT statement
8.3 Adding Filtering to Bar Chart 157
as shown in Figure 8.5. This SELECT statement will return the total count of sales grouped by
product names. Now that we have defined the source for our data that we want to show in the chart,
we need to map the columns selected by the SELECT statement to axes Label (X) and Value (Y).
The final configuration of our series is shown in Figure 8.5 with the important changes highlighted.
If we take SQL Query from Figure 8.5 and execute it, it returns data as shown in Figure 8.6.
Now, we can save our page and run it. Don’t forget to set the page’s authentication to “Page
Is Public” so that it doesn’t require logging in. When you run the page, you should get results like
those shown in Figure 8.7. However, you may notice that our chart doesn’t have labelled X and Y
axes, making it harder to read.
To address this, we can label our axes similarly to how we labelled our series. By clicking on
individual axes from the left tree overview and changing their Title attribute, as shown in Figure
8.8, we can name the X axis “Products” and the Y axis “Sales Count”.
Once we label both axes of our chart, the result should resemble the chart shown in Figure 8.9.
will write a SELECT statement as shown in Figure 8.13. This SELECT statement should return
exactly one column, which will be internally converted to a Colon Delimited List, which might
look like this: “1:5:7:2:3”.
Now, with the Checkbox Group item configured to our liking, we can link it to our Sales
Chart region. To do that, we will add the name of our Checkbox Group item to the “Page Items
to Submit” field in the “Source” section of our sales series inside the Sales Chart region. It is
required to add every item used in the SQL Query into “Page Items to Submit”. The return value
of “P1_PRODUCTS_CHOICE” is a Colon Delimited List, which consists of products that are
checked. Therefore, we need to use the INSTR function, which returns the index of the first occur-
rence of a substring defined in the second parameter of the function within the string defined in the
first parameter of the function. INSTR function will return 0, if there is no occurrence in string. We
will use the INSTR function to check if each product’s “product_id” is present within the selected
list of product IDs in the “P1_PRODUCTS_CHOICE”. The INSTR function searches for the oc-
currence of ’:’||product_id||’:’ within the concatenated string ’:’||:P1_PRODUCTS_CHOICE||’:’.
If it finds a match, it means that the product is among the selected products. We need to concatenate
’:’ to both “product_id” and “:P1_PRODUCTS_CHOICE” because we want to perform a
precise match between individual product IDs. By doing so, we ensure that, for example, “:1: ” is
matched with “:1:2:3:8:9:11: ”. This ensures that we’re looking for exact matches, ensuring that
each selected product ID is considered independently.
If we were to match “1” with “1:2:3:8:9:11”, we could potentially display a product with the
ID "1" when checkboxes for products with IDs “1”, “11” or any other IDs containing the value “1”
are checked. In other words, if we check product with ID “11”, not only the selected product would
be displayed, but also product with ID “1” would be displayed. This leads to undesired results and
inaccurate data representation.
By adding ’:’ to both sides of the IDs, we create a consistent delimiter pattern, making sure that
8.3 Adding Filtering to Bar Chart 159
the selected product IDs are compared precisely and eliminating any ambiguity in the matching
process. This ensures that the chart displays the data accurately based on the user’s selections.
The last configuration step is to set up the refresh of our Sales Chart region when there’s a
change in the selection of the Checkbox Group item. To achieve this, we need to create a Dynamic
Action on our “P1_PRODUCTS_CHOICE” Checkbox Group item, as shown in Figure 8.15.
We can set the “Name” attribute of this Dynamic Action to “PRODUCTS_CHOICE_REFRESH”
as seen in Figure 8.16. We also need to make sure that “Event” attribute inside “When” sec-
tion is set to “Change” and that “Selection Type” attribute is set to “Item(s)” and “Item(s)”
attribute is set to our current item name, so this Dynamic Action will be fired when the value of
“P1_PRODUCTS_CHOICE” changes.
Within the tree overview on the left side of the Page Designer, click on the action that executes
when the Dynamic Action condition is true, which happens when our Checkbox Group item
changes. When you create a new Dynamic Action, you will see the “Show” action with an error,
so click on it. In the settings of this action, set the “Action” attribute inside the “Identification”
section to “Refresh”. In the “Affected Elements” section, change the “Selection Type” to
8.4 Adding Sorting to Bar Chart 160
“Region” and then set the “Region” to “Sales Chart”, as seen in Figure 8.17.
Figure 8.18 shows how your tree overview in the left part of Page Designer should look if
you’ve followed all the steps correctly.
When we run and test our application, the filtering and refreshing of our graph should be fully
functional, and the application should resemble the one shown in Figure 8.19.
region. We can do that by pressing the button right next to the “Order By Item” attribute, which
by default says “No Order By Item”, as highlighted in Figure 8.25.
After pressing the button, you should see that a new window has opened with the title “Order
By Item.” Inside this window, we first need to set the attribute “Name” inside the “Item” section
to “P1_CHART_SORTING”. Then, we need to fill the “Clause” column as seen in Figure 8.26.
These clauses are practically “ORDER BY” clauses used in SELECT statements but without
using the “ORDER BY” keyword.
If you have followed all these steps closely, chart sorting and refreshing should be working
when you save the page and run the application.
SQL Query for the series in the “Monthly Sales Chart” region. The SQL Query that we will
use is shown in Figure 8.30. We will also map “Label” to “SELL_MONTH” and “Value” to
“COUNT”. We are also ordering values by month number ascending and displaying the full month
name on the X axis. We will also set the label of the X axis to “Month” and the Y axis to “Sales
Count”.
If you’ve configured everything correctly, your chart should resemble the one shown in Figure
8.31.
8.6 Questions
1. What is the primary purpose of Oracle APEX chart regions?
2. Which types of charts can you create using Oracle APEX chart regions?
3. How can you refresh a chart region in Oracle APEX when user interactions, such as filtering
or sorting, occur?
4. What does the INSTR function do, and why is it used in Oracle APEX chart regions?
8.7 Answers
1. The primary purpose of Oracle APEX chart regions is to visually represent data, allowing
users to gain insights and make data-driven decisions.
2. Oracle APEX chart regions support various chart types, including bar charts, line charts, pie
charts, and more.
3. You can configure a Dynamic Action to refresh a chart region in Oracle APEX when user
interactions change the data, such as filtering or sorting.
8.7 Answers 163
4. The INSTR function is used to find the index of the first occurrence of a substring in a string.
In Oracle APEX chart regions, it’s used to check if specific values match selected criteria,
like product IDs in a list.
8.7 Answers 164
Figure 8.14: Linking Sales Chart region with Checkbox Group item.
Figure 8.21: Sales Chart region after placing and renaming Select List item.
Figure 8.24: Adding refresh Dynamic Action for Select List item.
Figure 8.26: Setting Order By clauses for Select List item used for sorting.
8.7 Answers 169
Figure 8.29: List of Values for Select List item used for filtering product sales by year.
Figure 8.30: Setting source SQL Query and column mapping for Monthly Sales Chart region.
The Top Navigation Menu provides a menu bar. It is ideal for more complex applications with
several layers of hierarchy within the navigation. It is shown in Figure 9.3.
The Top Navigation Tabs template automatically positions to the bottom of the screen for small
screen or mobile devices. The Top Navigation Menu resembles the most desktop applications.
9.6 Questions
1. The menu used in the Oracle APEX applications is commonly placed in the left part of the
screen. Which type does it refer to?
2. Where can you find the definition of the menu items to be edited?
3. Which menu type allows you to show all the items simultaneously without the necessity to
expand sub menu?
9.7 Answers
1. Side Menu.
2. Individual menu items form a list that can be created and edited similarly to any other list. It
can be accessed in Shared Components under the Navigation region.
3. Mega menu allows you to show all the items simultaneously just in one click with no necessity
to expand sub menus.
10. How to collaborate in a team?
habits written in one place. Just start doing it, and you will find out the best collaboration way for
your team.
In the beginning, when you think about some collaboration tools, you can consider basic
spreadsheets to monitor who is doing what. Of course, at the market, there are plenty of dedicated
applications for task management like Jira, Monday, ClickUp, Redmine, etc., and of course, with
the team and scale growing, you can consider using one of them as well. However, most of those
actions can be covered with features included in the Oracle Application Express platform.
You can lock a specific page by clicking the lock icon on the page lists in the Application
Builder or do it at the level of the page view.(see Figure 10.2). While locking or unlocking the page,
you can add a comment so you or other developers can see more information about the reason of
changes, or documenting work progress.
10.4.2 Comments
Oracle APEX allows developers to add comments to pages, regions, items, and many other
application elements. Comments can be used to provide context for other developers, explain the
reasoning behind a design decision, or simply document changes made to an application. By using
comments, developers can better communicate with each other and ensure that everyone is on the
same page (see Figure 10.3). Documenting your code for other team members or future developers
that will take care of app development or maintenance is important. Even if using a low-code
platform can self-define how a particular feature has been done, adding some information is still a
good practice if a specific element is created uniquely.
development, testing, and production. This makes managing changes across different environments
easier and ensures that the correct settings are applied when an application is deployed (see Figure
10.4). You can treat them as information if a particular feature (page, item, process) should
be included in the next release that will be exported/imported to another environment. While
exporting/importing your application, you can select if a particular "build" is included. Just imagine
the situation when one developer works on some feature and cannot make it before the deadline.
Instead of deleting this page from the application, you can just create a dedicated "build" for it and
exclude it during application export.
Using this feature can be a first step in defining CI/CD process for your application, which is
essential in professional software development.
project stages, and milestones, or templates for typical communication at the project (see Figure
10.7).
The most important part of this feature is the Issue section, where you can find all reported
issues, categorize them, and assign them to particular persons. Every issue can be set to more than
one developer, allowing each to add comments, discuss it within its context and change its status. If
required, users can upload files and basically run all issue-related communication inside "Team
Development". It is also important that all issues can be connected to a particular application and
page, so it’s straightforward to start an investigation and monitor which problems are related to
which part of the application. Issue status is a simple version of issue workflow that can be found in
many task management systems – users can report them, mark them as “in progress”, return to the
reporter, and close with information about the success or different reasons for closing (see Figure
10.8). Developers can also subscribe to issues assigned to them, which provides e-mail information
when there is any action at the level of the issue. The application allows users to limit the number
of e-mails by sending them as hourly or daily summaries.
We strongly recommend to start utilizing "Team Development" if your team does not have
another task management system implemented, or you use very basic tools like spreadsheets to
manage the project.
10.4.5 Feedback
Feedback Pages are a built-in feature in Oracle APEX that allows end-users to provide feedback
on the application’s functionality and performance. Feedback Pages can be customized to fit the
application’s needs and can include various types of feedback, such as bug reports, feature requests,
and general feedback.
It is crucial to get information from end-users and treat them as an extension of the development
team. The more closely we collaborate not only internally, but also with actual users of the
application, the better quality of the application we will have. It also allows the team to adapt the
application to real needs and helps build trust between the development team and users (see Figure
10.4 Features description 179
10.9). To turn it on, you need to select an option during application creation. If the application
already exists, go to "Edit Application Definition" and mark the "Allow Feedback" option in the
Properties section.
After activation, it adds a dedicated icon in the application menu. After clicking it, the end user
can submit feedback (see Figure 10.10).
The look of the Feedback page can be adjusted as it’s a standard APEX page. All information
the end-user provides is available in the Team Development section and can be analyzed by the team
(it is also possible to track it at the level of a particular application in its Administration section). In
addition, developers receive detailed information related to reported feedback (application ID, page
number, user’s data, information about its environment, etc.) and can transform it into an issue.
10.4.6 Standardization
While developing applications in the team, it is also very important to keep consistency between
the development standards of different team members. As in every aspect of collaboration, commu-
10.4 Features description 180
nication is the key to success – at the beginning of the project, the team should agree on the way of
development and utilization of APEX components. The most important aspects of that include:
• Naming convention (for items, processes, validations, dynamic actions, etc.);
• Page numbering and naming (alias);
• Allowed elements (e.g., for dictionaries we use just Interactive grids, every form must be
displayed as a modal page);
• UX/UI standards (e.g., look and feel of typical pages, alignment policy for different data
time, consistent formats of data, recommended icons for particular actions, etc.);
• Data consistency (e.g. having common dictionaries defined in one place the shared compo-
nents).
APEX gives a couple of solutions to help teams with standardization management. Most of them
can be found in the "Utilities" section at the level of the selected application (see Figure 10.11).
The most important at the beginning of development include:
• Cross-page reports (Page Specific Utilities) – allow developers to compare different APEX
elements (page attributes, reports, buttons, items, etc.) in the application to check consistency
and update them at once without manually changing attributes in multiple places.
• Change history/Recently updated pages – allows tracking actions taken by developers.
• Defaults definition (Attribute Dictionary) – allows the creation of a common dictionary to
10.5 Conclusions 181
keep naming consistent, formatting, data type, etc., for elements that repeat in many places
in the application. For example, "Update date" can exist on different reports or items in the
application, but we always want to have the same label and date format for every occurrence.
Of course, APEX gives many additional features and strategies to keep consistency at the
database and application level. For those who would like to extend their knowledge, please read
the APEX documentation, and check more advanced options like Global Page, Blueprints, User
Interface Defaults, Master Theme Application and Subscribe mechanism, APEX Views, or Plug-ins.
10.5 Conclusions
As a mature development platform, Oracle APEX provides many features to help with collaboration.
As low-code developers, we can utilize them and professionally create and maintain APEX-based
applications without extending the platform or integrating it with external tools. If you are new to
APEX and new to cooperation strategies in programming, start with the most fundamental steps
described in this chapter:
• Communication and regular meetings with the Team (live or remote – use tools like Google
Meet, Zoom, or MS Teams for video/voice, and Slack, Google Chat, or MS Teams for fast
messaging);
• Start using collaboration tools, e.g. APEX Team Development, to plan the development and
verify the progress;
• Start documenting your code and standards. And verify them!
Collaboration in low-code development sometimes might sound exaggerated, but it is worth trying
and gives just as much profit as in standard programming. What’s more, most of the typical
collaboration strategies like "code review", "pair programming", or "mob programming" can be
used as well with the low-code platform, even if sometimes the reviewed element is not pure code
but a process, page, or configuration.
Depending on the scale of the project, or standards implemented in the organization, at some
point in time, you may need to extend your collaboration process. For example, in large projects,
you will need to start using code repositories, automated building, and deploying tools, or software
dedicated to the testing and verification of the quality of your code. Utilizing elements of profes-
sional CI/CD processes like Git, Docker, Flyway, Liquibase, Jenkins, Gradle, SonarQube, Selenium,
10.6 Questions 182
Cypress, and many others is also possible with the APEX-based application. However, in many
situations, elements included in the platform are enough to create a game-changing application
with a team of fellow developers.
10.6 Questions
1. What is page locking feature and why does it matter?
2. How can developers communicate during the development with APEX?
3. What can team members utilize by using Team Development feature?
10.7 Answers
1. Page locking is a useful feature that prevents multiple developers from editing the same page
simultaneously and therefore preventing conflicts.
2. Developers can add comments to pages, regions, items, and many other application elements.
Comments can be used to provide context for other developers, explain the reasons behind a
design decision, or simply document changes made to an application. By using comments,
developers can better communicate with each other and ensure overall quality of software.
3. Team Development feature enable team members to manage development projects, in partic-
ular: to define milestones and project stages; create, assign, and monitor tasks/issues; apply
classifications using Label Groups and Labels; create issues templates, to make task creation
or reporting consistent; link Issues to an Application and Page; comment and discuss existing
issues; change their status and monitor the progress of the project stage and subscribe for a
different types of issues.
10.7 Answers 183
This chapter explores starter apps, sample apps and plug-ins available in Oracle APEX. All Oracle
APEX workspaces come with Sample Apps and Starter Apps (see Figure 11.1) and plug-ins. Starter
Figure 11.1: Oracle APEX workspaces come with Sample Apps and Starter Apps.
apps are stand-alone point-solutions that meet simple requirements and do not require complex
solution. On the other hand, sample apps are focused on the specific functionality and provide a
guide on how to make use of a particular feature. Plug-ins enable users to extend applications with
custom functionality.
3. Select Sample Apps or Starter Apps. Cards are used to list the apps. Unless the program
has previously been installed, each card contains an Install button. The Run and Remove
App icons are present if the application has already been installed.
4. Select Install App to do the installation of the app
5. Expand the Advanced Settings section. (Not obligatory)
a. Indicate whether the Application ID will be assigned manually or automatically (the
default).
b. Change the Parsing Schema.
6. Click Install Application to finish the installation.
By selecting the Remove App icon from the Gallery, users can uninstall apps that have been
installed from there. Applications that were imported from GitHub and downloaded do not have
an uninstall icon, so they must be deleted in order to be uninstalled from the workspace. Steps to
uninstall apps from the Gallery are as follows:
1. Go to the Workspace home page.
2. Select the Gallery icon. The Sample Apps, Starter Apps, and Custom Apps cards are
displayed when the Gallery page first loads.
3. Select Starter Apps or Sample Apps. Directly downloaded programs from the Gallery will
have a Remove icon and a Run icon visible.
4. To remove the app, click Remove.
Click Install.
• Sample Approvals - This application showcases Oracle APEX’s native Approval Compo-
nents’ capabilities. The Oracle APEX Consent components are highlighted, allowing users to
manage changes to employees’ payments and jobs after receiving the right person’s approval.
• Sample Calendar - This application showcases Oracle APEX’s built-in calendaring features.
A monthly calendar with styled daily tasks is included. Drag and drop, which is completely
declarative and quickly generated using native APEX wizards, may be used to update the
dates.
• Sample Cards – In Oracle APEX, this application highlights the Cards regions. Regions
with cards are a form of native region. They give developers a strong and adaptable new
method to present data in bite-sized bits, which is perfect for usage in faceted search or
presenting information quickly.
• Sample Charts – This application showcases Oracle APEX’s charting features. It explains
how you can use declarative and plug-in based charting tools to improve your applications so
that they visually portray your data.
• Sample Collections – This application provides users to store rows of data in Sample
Collections for usage in an Oracle APEX session. This database application demonstrates
the creation and management of collection-based session state using PL/SQL.
• Sample Data Loading - This application is constructed using straightforward EMP and
DEPT tables to demonstrate how developers may design pages that let users add spreadsheet
data into a table that already exists.
• Sample Dynamic Actions – This application showcases a variety of dynamic actions that
can be added to applications. These declarative client-side behaviors include straightforward
examples for modifying how components are displayed, style examples for customizing how
components look, and server-side examples for interacting with databases.
• Sample File Upload and Download – Learn how to build Oracle APEX apps with file
upload and download functionality. Utilize both, dedicated pages and dialog boxes to upload
files. Check out the process for downloading files from Oracle database BLOB columns in
database tables. See how to make file download links in forms, interactive reports, traditional
reports, and dynamic HTML content.
11.4 Plug-ins 188
• Sample Interactive Grids – The Oracle APEX Interactive Grid’s features and functionality
are highlighted in this application. Those features are highlighted on the interactive grid
sample sites.
• Sample Maps – Numerous examples of viewing coordinate data on a map are provided in
this application. Use the heat map feature, lines, polygons, or map markers. The Oracle
Spatial capabilities (available in every Oracle Database) may be readily integrated with the
APEX Map Region to carry out a "Within Distance Search," "Nearest Neighbor Search," or
other spatial analyses.
• Sample Master Detail – This application showcases Oracle APEX’s native master detail
capabilities. There are four possible master detail page layouts in the application. The first
two layouts use editable Interactive Grids to display master detail on a single page. The
final two layouts present the master detail on two pages, using a combination of editable
Interactive Grids, form inputs, vintage reports, and modal popups.
• Sample Reporting – This application showcases Oracle APEX’s reporting features. Using
SQL, users are able to declaratively construct Interactive Reports, Interactive Grids, Faceted
Search Reports, Cards Reports, and Classic Reports.
• Sample REST Services – This application demonstrates how to use Oracle APEX to connect
to external REST services. Oracle.example.hr, a prototype RESTful Service, is used by the
app. Examples in this application demonstrate how to filter, how to add pagination, and how
to produce a straightforward tabular report on REST service data.
• Sample Trees – Find out how to use a SQL query to construct a tree control. The Oracle
APEX application in this example demonstrates several ways to incorporate tree controls.
• Universal Theme Reference - By giving you a simple way to navigate through the numerous
templates, template choices, and theme styles, this app introduces users to Universal Theme.
The examples show how users may quickly manage your page layout to produce a stunning
application.
11.4 Plug-ins
Plug-ins allow for the Application Express framework to be readily extended with custom item
types, region types, processes and Dynamic Actions. Once defined, plug-in based components are
created and maintained very much like standard Application Express components. Plug-ins enable
developers to create highly customized components to enhance the functionality, appearance and
user friendliness of their applications. Plug-Ins allow users to add additional functionality to APEX
apps with plug-ins that is not built-in to the platform. The APEX Community has developed a large
range of different plug-ins useful for expanding existing features or adding new features. There are
hundreds of plugins for Oracle APEX categorized into five types:
• Dynamic action
• Region
• Item
• Process
• Authentication
Oracle Application Express offers various plugins within each category. Plug-ins give you the
option to add new features to your application declarative, thereby enhancing the built-in types.
Because plug-ins are intended to be reused, developers can share them with the Oracle Application
Express Plug-in community by using the Plug-in Repository as well as export and import them to
different workspaces. The steps involved in implementing a plug-in are as follows:
• Add a plug-in to your application workspace or create one from scratch.
• To utilize the plug-in, edit or create a dynamic action type, item, region, process, or autho-
rization scheme.
• Launch your application to check the functionality of the plug-in.
11.4 Plug-ins 189
A central location for developers to share and download plug-ins is the Plug-in Repository. On the
Oracle Technology Network, the repository can be found.
• To see the repository for plug-ins, go to the page for Shared Components:
– Click App Builder on the Workspace main page.
– Decide on an application.
– Choose Shared Components on the application’s home page.
• The page for shared components appears.
• Select Plug-ins from the Other Components menu.
• Press the View Plug-in Repository button.
The repository for Oracle Application Express Plug-ins is displayed. To access the Plug-ins page:
• Go to the Shared Components page.
– Click App Builder on the Workspace main page.
– Select an application.
– Choose Shared Components on the application’s home page.
• Select Plug-ins from the Other Components menu. The Plug-ins tab is automatically selected
when the Plug-ins page loads. The whole list of plug-ins is displayed.
To create a plug-in:
• Go to the Shared Components page.
– Click App Builder on the Workspace main page.
– Select an application.
– Choose Shared Components on the application’s home page. The Shared Components
page appears.
• Select Plug-ins under Other Components,
• Click Create. The Create Plug-in wizard appears.
• Click Next after choosing the method for creating a plug-in under Create Plug-in.
• Within Name:
– Name – Fill in the name of the plug-in.
– Internal Name - Fill in the internal name of the plug-in. Name should be unique within
the application.
– Type - Decide which kind of component can make use of this plug-in. The options
under Callbacks and Standard Attributes vary depending on the plug-in type you choose.
See field-level Help for more information.
– Category - only appears if Dynamic Action is the specified kind. On the user interface,
choose the category the plug-in is listed under.
• Within Source:
– PL/SQL Code - Enter a PL/SQL anonymous block of code containing the steps required
to render, validate, run, and execute this plug-in’s callbacks. You can alternatively store
this code in a PL/SQL package in the database for performance reasons.
– Do not validate PL/SQL code - To only parse the PL/SQL code at runtime, choose this
option. If not, the plug-in is built once the code has been parsed.
• Within Callbacks, configure the attributes. The plug-in type determines the attributes that are
displayed. Check out the field-level help to examine samples and learn more about attribute.
• Within User Interfaces, choose which displays the App Builder must be able to support for
this plug-in. Options include:
– Desktop
– Mobile
• For Standard Attributes, select the attributes that apply to this plug-in. Standard Attributes
dispense with certain plug-ins.
• Within Information:
– Version - To specify the plug-in version, enter a string.
11.4 Plug-ins 190
– About URL - Enter a URL leading to the homepage of the plug-in-author in’s or to
more details about the plug-in.
• Click Create Plug-in.
Please note that the above applies to APEX version 22.1. Newer version 23.1 delivers an even
better way to create a Plug-in. To import a plug-in:
• Go to the Shared Components page:
– Choose App Builder on the Workspace home page.
– Choose an application.
– Select Shared Components on the Application home page.
• Select Plug-ins within Other Components
• Select Import. The import Plug-in page appears.
• For Specify File:
– Import file - Enter or navigate to the import file’s name.
– File Type - Choose Plug-in.
– File Character Set - Choose the character set encoding for import files.
– Click Next.
• For File Import Confirmation, select Next.
• For Install, select Install Plug-in.
To export a plug-in from the Plug-in page:
• Go to the Shared Components page:
– On the Workspace home page, click App Builder.
– Select an application.
– On the Application home page, click Shared Components.
• Within Other Components, select Plug-ins.
• Under Tasks, select Export Plug-in.
• On the Export Plug-in page:
– Application - Choose the application to export the plug-in from.
– Plug-in - Choose plug-in.
– File Format - Choose file format of the export.
– Choose Export
• Choose Export.
In the next few lines one example of plug-ins is provided. The example refers to the updated sample
calendar app and dynamic action plugin. This example plug-in can be used to format days in the
new date picker item. Users can disable it, add tooltips or classes to each day in the day grid of the
date picker. There are no prerequisites for using this plugin. How to use it:
• Create an application
• Import the Plug-in in Shared Components - Plug-ins
• Add a new date picker
• Add a Dynamic Action on Page Load and select as action the imported plug-in
• Set an URL of a iCalendar standard file format or enter a SQL Query that should format the
calendar days
• Select as Affected Element the desired date picker and run the page
This chapter demonstrated that plugins can offer several benefits. No matter how strong it may
be, no single piece of software can provide every function for every user. The gap between form
and function is filled by plugins. They make it simpler to add particular functionality to software
and apps. As such, plugins are time-saving. The biggest benefit of using plugins is that they reduce
the amount of time required for development, which lowers the overall cost. Furthermore, plugins
allow users to customize the features and functionality. Most plugins enable to turn on and off
particular settings. It is a simple process to remove a plugin, if there is a need for that.
11.5 Questions 191
11.5 Questions
1. What are sample apps and what are their benefits?
2. What are starter apps and what are their benefits?
3. What are benefits of plugins?
11.6 Answers
1. Sample apps are created to highlight particular capabilities and act as a developer’s manual
for utilizing a specific feature.
2. Starter Apps are useful apps that offer standalone point solutions, created to satisfy straight-
forward requirements that don’t call for a substantial and unnecessary complex answer.
3. Plug-ins enable developers to create highly customized components to enhance the func-
tionality, appearance and user friendliness of their applications. Plug-Ins allow users to add
additional functionality to APEX apps which are not not built-in.
12. How to manage packaged and
multilingual applications?
There are several options in export like splitting into multiple files, choosing file character
set, opt in or opt out public or private reports and similar. In most cases, the beginner simply
allows APEX to apply default settings. Whilst the developer logs into a new workspace and
launches import wizard which loads the exported text file. Definitions of tables, views, triggers,
sequences, functions, procedures and packages are not migrated with application if we do not
prepare supporting objects. If a target workspace already contains database object definitions and
data in the tables then we should prepare supporting objects to handle such situations.
The first part of this chapter will use APEX wizards as much as possible. Then simple SQL
INSERT statements not supported by wizard in APEX will be presented. To generate INSERT
statements the reader can import data in spreadsheet and then export INSERT statements with
other tools (i.e. SQL Developer or TOAD). The application in this chapter will introduce a page
component called lists of values (LOV). It belongs to shared components. List of values have two
purposes: to allow the user to fill the form field on the the web page easily (drop-down, radio
button) and with just prescribed values to avoid typing mistakes. Two types of list of values are
available: dynamic are based on SQL query while static offers fixed set of values. The benefit of
dynamic list of values is that the domain depends on table or view. The end user can change the
domain by inserting, updating and deleting rows in the table. The drawback is that a table must be
created and maintained. If the domain does not change and the number of rows in the table is small
then a static list of value could be applied. In that case only the developer can change the domain
(it is "hard-coded").
The second part will demonstrate the creation of packaged application, exporting it, and
importing it in new workspace.
The third part of the chapter will provide instruction to create a multilingual application. As a
supplementary study material, three exported applications are provided as well as video clip which
shows the development process in detail.
12.2 Application 194
12.2 Application
12.2.1 Scope of application
The application aims to manage jobs and competences for a HR department. There can be a
few hundred jobs in one company. One job may include a specific subset of all known compe-
tences. Required level of competence is prescribed by HR department for each job. The levels
of competence describe the ability to: assist, use, master, tailor and innovate. So, the idea is to
develop an application to prepare and manage job profiles. The application uses three tables: JOB,
COMPETENCE and JOB_COMPETENCE with minimal number of data fields (for the sake of
simplicity and conciseness). Each table has a primary key and table JOB_COMPETENCE has two
foreign keys to relate each row with rows JOB and COMPETENCE table. Foreign keys ensure data
consistency: namely a row in the JOB_COMPETENCE table can only exist if rows with the same
primary keys exist in tables JOB and COMPETENCE. Table names in this chapter will be prefixed
with "CH12_" to assure uniqueness and to prevent interference with tables used in other chapters.
CH12_JOB
job_description vc100
CH12_COMPETENCE
competence_description vc100
CH12_JOB_COMPETENCE
id_job num /fk CH12_JOB
id_competence num /fk CH12_COMPETENCE
required_level vc10 /check ’assist’,’use’,’master’, ’tailor’,’innovate’
After entering the above text and pressing Generate SQL button the following screen appears
(see Figure 12.2): Then click Save SQL Script button and name the script as CH12CREATE.
We can now execute the script. Return to Scripts, and find the Run icon in the row where script
CH12CREATE is shown. Click Run icon. Three tables and three indexes should be successfully
created. You can check the tables in Object browser.
Figure 12.3: Script CH12INSERT insert data in three tables and commit transactions.
Twenty-four rows should be successfully created. You can check the content of tables in Object
browser too.
list of values (LOV) in application pages we will make the application more error resistant and also
more user-friendly. That means that the user can not fill arbitrary values into the form field thus we
mitigate typing errors. Navigate to Shared components (see Figure 12.6). In shared components
select List of values (in Other Components) and click Create. We will create list of values from
scratch (see Figure 12.7).
Name LOV as CH12_LOV_COMPETENCE_DESCRIPTION and select Dynamic type (see
Figure 12.8) Select SQL Query as source type and enter query "select competence_description as d,
id as r from ch12_competence" as SQL select statement (see Figure 12.9). This list of values will
display description of competence (display column) on the form page while returning ID (return
column). Next LOV will be static, named CH12_LOV_COMPETENCE_LEVEL and created as
shown in Figure 12.10 and Figure 12.11.
Navigate to application pages (see Figure 12.12). Select page 7 (Ch12 Job Competences).
Modify page item P7_ID_COMPETENCE:
• type is "Select list" in Identification
• type is "Shared components" in List of values
• list of values is CH12_LOV_COMPETENCE_DESCRIPTION List of values
Modify page item P7_REQUIRED_LEVEL:
• type is "Select list" in Identification
• type is "Shared components" in List of values
• list of values is CH12_LOV_COMPETENCE_LEVEL List of values
Save the page 7, navigate to page 6 and run application. You should see Figure 12.13. Now edit
first entry. Both select lists provide expected data.
states to support more than one language. The scale of adaptation may be limited to translation
of page item labels, application messages, APEX internal messages, number and date formats
or as complex as translating the text stored in database tables (i.e., status, level, grade). Specific
cultural and linguistic context may cause pure string translation to generate funny, offensive or
non-competent content. So, localization of the application means much more than just translation.
APEX has a lot of possibilities to apply translation (based on primary application language, browser,
application preference, item, session). The following part provides the simplest instructions to
implement multiple languages in application by changing application primary language. The steps
are:
• Navigate to Shared components > Globalization > Application Translations > Define applica-
tion languages: click Create button; for each language set unique integer and value (i.e. add
two digits to application number like 10801 for sl; 10802 for hr; 10803 for de-at; 10804 for
el; 10805 for sk; 10806 for pl). Figure 12.24 shows all languages set.
• Navigate to Shared components > Globalization > Application translations > Seed translatable
text. Select all languages as shown in Figure 12.25. Click Seed button and wait until seeding
is finished.
• navigate to Shared components > Globalization > Application Translations > Download
XLIFF translation files; we can choose to download all translatable elements or only those
elements requiring translation. Example in Figure 12.26 shows export of Page 2, Slovenian
language and elements requiring translation.
• edit exported file in preferred editor (Notepad++, Kate, Sublime etc.). For demonstration
purposes we changed only a few "target" tagged strings: in lines 48, 52, 56, 60, 72 and 76
(see Figure 12.27). Save changes.
12.5 Supplementary learning material 199
• navigate to Shared components > Globalization > Translate application > Apply XLDIFF
translation files > Upload Files. Select the file (see Figure 12.28) and click Upload. Choose
the proper language in "Apply to Translation" (see Figure 12.29). Click Apply checked.
Click Publish.
• navigate to Shared components > Globalization > Translate application > Publish translations.
Select all languages that you translated and click Publish (see Figure 12.30). Wait until you
receive message that application is successfully published.
• navigate to Shared components > Globalization > Globalization attributes. Change Applica-
tion Primary Language to new translation (see Figure 12.31). Click Apply changes.
Now check Page 2 in translated application (see see Figure 12.32).
Concluding remarks
Development usually takes place in a test environment. When migrating the approved application to
a new workspace, packaged applications are very convenient since they reduce time for migration.
For security reasons eventual users and their roles are not migrated. The authorization of users in
a new workspace is a serious task. This chapter also provided basic instructions for multilingual
applications. It should be noted that for large and critical mission applications the translation
process must be supported by capable automatic translation tools as well as language and culture
human specialists.
• video guides
All supplementary learning material is available on public BeeAPEX project page. Login as a guest
user (no password is required). Find textbook in Books section, scripts in folder Part 1 > Chapter12
in the Scripts section and video guides in Collection of video guides. Material for short courses in
in Short courses section.
12.7 Answers
1. Packaged application is a pre-built application that can be installed and configured in an
Oracle APEX workspace. The main benefit of a packaged application is the easy and smooth
migration as well as immediate availability of prepared data.
2. Packaged application is to be exported with wizard. One can include scripts which define
database objects (like tables) and instruct inserting data into tables. The list of scripts and the
order of execution of these scripts is set in wizard. Packaged application can also contain
de-installation scripts.
3. XLDIFF file is tagged and therefore provide easy access to target values for translation strings.
These files can contain an entire application or just a specific page in a selected language.
File with translated target strings is imported into application. Translation repository needs
to be published to be available to end-user.
12.7 Answers 202
Figure 12.27: Translation of "target" tagged strings in lines 48, 52, 56, 60, 72 and 76.
II
Constructing application in APEX
13 Intranet news for employees . . . . . . . . 209
R OBERT L ESKOVAR , U ROŠ R AJKOVI Č AND A LENKA B AGGIA . .
viewer/reader of the news, who has the privilege to read internet news.
Requirement specification Based on the modified process, the platform will enable users to:
• Reader/Viewer: login, access the dashboard, view news and attachments to news
• Publisher: login, access the dashboard, view and publish news and add attachments to
published news
• Administrator: login, access the dashboard, view and publish news, view and manage
departments, roles, employees, employee roles, manage application
Extensions:
• 1a. Sign-in fails
• 1a* Extend:
• 1a1. Show error message
• 1a2. Open sign-in window
• 4a. Datatype error
• 4a* Extend:
• 4a1. Show error message
• 7a. Datatype error
• 7a* Extend:
• 7a1. Show error message
Frequency of Use: The publishers publish approximately 1000 news per year, average 5 per
day
Status: Finished
Owner: Employee with publishing role
Priority: moderate
13.3 Use cases 212
Extensions:
• 1a. Sign-in fails
• 1a* Extend:
• 1a1. Show error message
Extensions:
• 1a. Sign-in fails
• 1a* Extend:
• 1a1. Show error message
• 1a2. Open sign-in window
• 2a. Datatype error
• 2a* Extend:
• 2a1. Show error message
• 3a. Datatype error
• 3a* Extend:
• 3a1. Show error message
• 4a. Datatype error
• 4a* Extend:
• 4a1. Show error message
• 5a. Datatype error
• 5a* Extend:
• 5a1. Show error message
Frequency of Use: The frequency of use depends on new employees and changes in the privi-
leges scheme. Approximately 5 times per week.
Status: Finished
Owner: Intranet portal administrator
Priority: high
13.4 Data model 214
Again for the sake of simplicity extension use case (adding attachment to the news) is skipped
in Figure 13.1.
Now it is time to generate tables in Oracle database. We can import the generated script and
execute it in APEX.
The page for publishing news with attachments and its details is presented in Figure 13.5.
The Viewer (Reader) role has the most limited dashboard. Only the Home and the View news
is available for now, as presented in Figure 13.6.
The main feature for the Viewer (Reader) is to access news (see Figure 13.7).
In addition to viewing and publishing news, the administrator can manage departments, roles
and employee with roles data, as depicted in Figure 13.8. Also, the administration page is available,
where user management is possible.
13.6 Supplementary learning material 216
The page for editing employee roles data is presented in Figure 13.9. This page is only available
to the Administrator of the intranet portal.
13.7 Questions
1. How would you change logical data model to implement the following requirement: one
attachment can belong to more news.
2. How would relational data model change if the requirement (one attachment can belong to
more news) is implemented?
3. Which user roles are implemented in Chapter 13 application and why?
13.8 Answers
1. One-to-many relation should be allied in direction from attachment to news.
2. Pair attachment-news in logical model would be transformed into three relational tables:
attachment, news and attachment_news. The last one would contain at least two fields (IDs
of attachment and news) both serving as a foreign keys.
3. In Chapter 13 the following user roles are implemented: Administrator, Contributor and
Reader. These roles are implemented to enable authorized users to do their job and to prevent
unauthorized users to perform unapproved actions.
13.8 Answers 218
• Some functionalities of the Catalog Management are made available to users authorized by
the administrator (authorized user).
• Advanced functionalities, are available to the administrators, include linking to other pages
that contain information about the plant, videos on cultivation, use of plants etc.
• All registered users (Members) can, if they wish, share their opinion about the plant, write a
review, add some more information, etc., but that is not part of this functionality.
Extensions:
• Search Form (QBE)
• Tabular Form
• Details of the Plant Form
• add APEX user before running application. Only in development and testing workspace
navigate to Shared Components > Application Access Control > Add User Role Assignment;
enter APEX user and set this user roles Administrator, Contributor and Reader. In production
consultation with skilled personnel before deployment in a must.
If user is not granted appropriate role than imported application will crash. It is necessary to
clear web browser cookie (i.e. Firefox: Settings > Cookies and Site Data > Manage Data) after
application crashes due to unmet requirements.
14.7 Questions
1. Investigate how communication with an External Source, or another database or system that
contains plant data, could be implemented.
2. List some of the formats in which images of plants and seeds are stored.
3. In which data type are images, videos and similar objects saved in the Oracle database?
14.8 Answers
1. In principle, there are two ways of realizing communication with such an external source.
One way is to download the dataset, i.e. the complete database into the Catalog of plants.
Another way is to connect with the help of an Application Programming Interface (API). It is
a set of protocols, tools, and standards that defines how software components should interact
and communicate with each other. APIs allow different software systems to communicate
and share data with each other in a standardized way.
2. Some of the most common formats are:
a. JPEG (Joint Photographic Experts Group) - this is a popular format for digital photos
due to its compression capabilities, which allow for smaller file sizes without significant
14.8 Answers 225
loss of quality. It supports millions of colors and can handle high-resolution images.
b. BMP (Bitmap) - this format is commonly used in Windows operating systems and can
support both grayscale and color images. It does not support compression, so files can
be large, but it is a good option for storing high-quality images.
c. PNG (Portable Network Graphics) - this format is known for its lossless compression,
which means that the image quality is not compromised when the file size is reduced. It
supports transparency and is often used for web graphics and digital art.
d. TIFF (Tagged Image File Format) - this format is commonly used for storing high-
quality images, such as those used in printing. It supports lossless compression, multiple
layers, and can handle both gray scale and color images.
3. Images, videos, and similar objects are typically stored in the Oracle database using the
BLOB (Binary Large Object) data type. BLOBs can store binary data, such as images
and videos, up to 4 gigabytes in size. This data type is ideal for storing large objects like
multimedia files, as it allows for efficient storage and retrieval of binary data.
15. GreenDi - User Authorisation and
Management
uses OAuth 2.0 to access Google APIs must have authorization credentials that identify the
application to Google’s OAuth 2.0 server.
Figure 15.1: Use case diagram - GreenDi User Authorization and Management
15.3 Use cases 228
Extensions: Log In form; User Registration Form; Table of Users Form; User Details
Form; User History Form
Frequency of Use: Approx. maximum is 100 per day.
Status: Development status
Owner: public, anonymous user
Priority: high
15.4 Data model 229
15.7 Questions
1. What are built-in and application level user authentication and authorization functionalities
when developing applications using Oracle APEX?
2. How can we use external authentication in APEX?
3. What are the advantages for users when they log into an application with their Facebook,
Google or similar accounts?
15.8 Answers
1. a) Built-in User Authentication: APEX provides built-in user authentication functionality,
allowing you to define and manage user accounts directly within the APEX environment.
Users can have different roles and privileges, and you can control access to specific application
pages or components based on user roles. b) Application-Level Authorization: APEX allows
you to define fine-grained authorization rules at the application level. You can specify which
users or roles have access to specific pages, regions, buttons, or other components within
your application.
2. We you can use login options like Facebook, Google, and other platforms in an application
or website that you develop ourself. Many popular platforms provide developer APIs
(Application Programming Interfaces) that allow you to integrate their login functionality
into your own applications or websites. For example, Facebook provides the Facebook
Login API, which enables users to log in to your application or website using their Facebook
credentials. Similarly, Google provides the Google Sign-In API, which allows users to sign
in using their Google accounts. To implement these login options, you typically need to
register your application or website with the respective platform’s developer portal. This
registration process usually involves obtaining API keys or client IDs, which you will then
use in your code to authenticate users and manage the login process.
3. By incorporating login options from these platforms, you can offer your users a convenient
and familiar way to sign in to your application or website without requiring them to create
new accounts or remember additional login credentials. There is no need to register and enter
name, address and similar data, no new user names and passwords are created that need to be
remembered.
16. Small Innovation System
Again, for the sake of simplicity extension use case (adding an attachment to the idea) is skipped
in Figure 16.1.
Extensions:
• 1a. Sign-in fails
• 1a* Extend:
• 1a1. Show error message
• 1a2. Open sign-in window
• 4a. Datatype error
• 4a* Extend:
• 4a1. Show error message
• 7a. Datatype error
• 7a* Extend:
• 7a1. Show error message
Frequency of Use: On average, the company receives 3 innovative ideas per week.
Status: Finished
Owner: Employee with access to the application
Priority: moderate
16.4 Data model 235
Extensions:
• 1a. Sign-in fails
• 1a* Extend:
• 1a1. Show error message
Frequency of Use: The option to view ideas is given to employees, reviewers and administra-
tors. Altogether, they access the platform approximately 5 times per day.
Status: Finished
Owner: Employee with sign-in option
Priority: low
16.4 Data model 236
Extensions:
• 1a. Sign-in fails
• 1a* Extend:
• 1a1. Show error message
• 1a2. Open sign-in window
• 2a. Datatype error
• 2a* Extend:
• 2a1. Show error message
• 3a. Datatype error
• 3a* Extend:
• 3a1. Show error message
• 4a. Datatype error
• 4a* Extend:
• 4a1. Show error message
• 5a. Datatype error
• 5a* Extend:
• 5a1. Show error message
Frequency of Use: Managers review the proposed ideas once per month.
Status: Finished
Owner: Reviewer
Priority: high
16.4 Data model 237
Oracle SQL Data Modeler also generates SQL script for table, sequence and trigger creation.
Select all tables on relational model and use function File > Export > DDL File to get a script like
this:
CREATE TABLE CH16_AWARD (
AW_ID NUMBER NOT NULL
...
16.5 Application interfaces 238
);
Now it is time to generate tables in Oracle database. We can import the generated script and
execute it in APEX.
The page for submitting ideas with attachments and its details is presented in Figure 16.5.
Each employee has the option to view the Organizational structure in the company, as presented
in Figure 16.6.
16.6 Supplementary learning material 239
Also, each employee can see the dashboard of charts presenting the distribution of ideas over
time alongside data demonstrating the breakdown of accepted, rejected, and revised ideas; and
employees with the highest number of innovative ideas in the company (see Figure 16.7).
In addition to the described actions, the reviewer has the option to update data about awards
and employees, as depicted in Figure 16.8. The administration page is available only to the
administrators, not to reviewers.
The page for reviewing the idea is presented in Figure 16.9. This page is only available to the
Reviewer. The Reviewer selects the decision and the type of award if applicable.
16.7 Questions
1. Where are user roles in Chapter 16 defined?
2. Which relationship in the logical data model enables the presentation of Organizational
structure in Chapter 16?
3. Why are some fields on the page for idea review disabled in Chapter 16?
16.8 Answers
1. No roles are defined in the Chapter 16 data model. They are only used in APEX environment.
2. The relationship connecting the Employee table with itself (recursive relationship) enables
the presentation of Organizational structure in Chapter 16.
3. In Chapter 16 some fields are disabled to create a better user experience and assure consistency
of the data since the user is not required to add data which are already in the database.
16.8 Answers 241
Microsoft, IBM, SAP, Oracle as well as myriad of smaller contributed to software platforms which
aimed to provide seamless integration of business functions. Apart from software world other
industries have sharpened focus on processes through the lens of specific businesses from 1980s
with quality management initiatives and standards.
Since the 1990s, the disciplines of business process management (BPM) and business process
re-engineering (BPR) have important roles when organizations want to improve their performance.
BPM focuses on the representation and documentation of a company’s workflows, operations
and processes using diagrams, flowcharts, or other visual aids. The goal is to understand and
improve existing processes, or design new ones, to increase efficiency and reduce inefficiencies.
BPR is sought as the fundamental rethinking and radical redesign of business processes to achieve
significant improvements in performance and productivity. It involves the analysis and design of
workflows and processes within an organization, with the goal to be more efficient, effective, and
capable of adapting to the changing business environment. BPR can involve utilization technology
and information systems to automate processes and enhance decision-making.
In BPM and BPR several diagrams can be used:
• Flowcharts: A simple and intuitive way to represent a process as a series of steps, decisions,
and loops.
• Swimlane diagrams: A type of flowchart that adds a visual representation of who or what is
responsible for each step in a process.
• Process maps: A high-level view of the steps and activities, involved in a process, often
including inputs, outputs, and decision points.
• BPMN (Business Process Model and Notation [4]): An industry standard notation used for
modeling business processes, standardized by the Object Management Group (OMG).
• EPC (Event-driven Process Chain): A type of flowchart that uses events as the driving force
behind a process, instead of activities.
• IDEF (Integration Definition for Function Modeling): A method used in software engineering
to model and analyze processes and systems.
The choice of diagram type to present workflow depends on the level of details needed, the purpose
of the model, and the target audience. At this point we will focus on BPMN only as: a) BPMN has
standard notation and wide acceptance across different industries and b) BPMN is implemented
as modeling diagram type in Oracle Application Express (APEX) feature (sometimes referred as
extension) called Flows for APEX. Flows for APEX is open source, licensed under very permissive
MIT Licence. Flows for APEX allows developers to build and deploy web-based applications
using a visual, drag-and-drop interface. Flows for APEX provide a way to automate and simplify
complex business processes by breaking them down into a series of steps and tasks, and guiding
users through them.
Flows for APEX can include a variety of elements, such as pages, forms, reports, and dialogs,
and can be configured to include branching logic, conditional branching, data validation, and
error handling. The visual interface of Flows for APEX makes it easy for developers to design,
build, and test business processes, without the need for extensive coding. It can be integrated with
other Oracle APEX components, such as SQL, PL/SQL, and REST services, to create complete,
web-based applications as well as to build custom solutions for specific business needs, such as
workflow management, customer on-boarding, and data management. Overall, Flows for APEXs
provide a way for organizations to streamline and automate complex business processes, improve
productivity, and reduce errors and inefficiencies. Excellent tutorials on Flows for APEX are also
available. So, how can we link APEX as low-code programming environment and Flows for APEX
with embedded standard BPMN presentation?
Activity diagram (see Figure 17.1) depicts the simplified presentation of integrating Flows and
APEX application. Steps in Figure 17.1 3. modeling data, 4. developing application, 6. defining
user roles, 7. testing and 8. removing errors from application are common for all APEX applications.
17.1 Business view of the case 244
Step 1. installing Flows for APEX is similar to installing any other packaged application. The real
novelties are 2. modeling the workflow and 5. linking APEX application with workflow.
Readers not acquainted with business process management (BPM) and business process mod-
eling notation (BPMN) diagrams are advised to search for popular textbooks and study already
mentioned BPMN spefification [4]. As a brief reminder for all readers, the following elements of
BPMN diagrams are the most commonly used:
• Start Event: Indicates the starting point of a process.
• Task: Represents a single unit of work, such as an activity or a step in the process.
• Gateway: Represents a decision point in the process, such as a fork in the flow or a conditional
branch.
• Sequence Flow: Connects elements in the diagram and represents the flow of control from
one element to another.
• End Event: Indicates the end of a process.
• Pool/Lane: Represents a grouping of related tasks, used to define the roles and responsibilities
of different participants in the process.
• Message Flow: Represents the flow of messages between participants in a process, such as a
communication between two systems.
• Data Object: Represents a piece of data that is used or produced in a process, such as an
invoice or a customer record.
• Data Store: Represents a container for storing data that is used or produced in a process, such
as a database or a file system.
These elements can be combined to create detailed and accurate models of business processes,
allowing organizations to identify areas for improvement and optimize their workflows.
17.2 Getting started with Flows for APEX 245
inquiry sales must prepare multiple documents for decision makers. The production manager and
his team evaluate the inquiry manufacturing aspect. They provide an expert opinion on a company’s
capability to produce the required product item. If the product item can be manufactured, then the
team provide estimated duration of manufacturing process in days. Financial manager and his team
evaluate the inquiry financial aspect. They provide an expert opinion on the company’s capability
to provide financing and estimate the expected profit. The final evaluation and the decision is taken
by chief executive officer and his team. They consider the feasibility (manufacturing, financial),
estimate the importance of the customer and make decision abaout the inquiry. Depending on the
company’s capability to manufacture and to finance the business opportunity as well as business
prospect, the CEO decide to how to reply to customer: a) send business proposal with manufacturer’s
price and expected delivery duration or b) message to inform the customer that the manufacturer
can not send business proposal.
Bad business decisions (send business proposal or reject the business) can have disastrous
impacts on manufacturing company such as lost earnings, low profit, bad reputation due to exceeded
delivery dates and even bankruptcy. The situation presented cause headache to all involved: sales
person, production manager, financial manager and chief executive officer. IT department is
responsible to provide user-friendly, reliable and secure software support for described workflow.
Their problem is to develop such support with Flows for APEX.
To developed the application, you must have installed Flows for APEX. This chapter will
analyze the business case (description, semi-structured description, use case diagram, process
model, data model) and develop application. You will learn:
• how to define a process model (workflow) for this business case,
• how to create data model and develop APEX application
• how to link developed application with defined workflow
Please keep in mind that user authorization will not be implemented because this would expand
this chapter beyond reasonable student effort.
Extensions: -
Frequency of Use: Approx. 250 per year, average 5 per week.
Status: [Development status]
Owner: Sales person
Priority: high
Extensions: -
Frequency of Use: Approx. 250 per year, average 5 per week.
Status: [Development status]
Owner: Production manager
Priority: high
17.4 Use cases 248
Extensions: -
Frequency of Use: Approx. 250 per year, average 5 per week.
Status: [Development status]
Owner: Financial manager
Priority: high
Extensions: -
Frequency of Use: Approx. 250 per year, average 5 per week.
Status: [Development status]
Owner: Chief executive oficer
Priority: high
17.5 Workflow model 249
All four tasks are defined as "Manual task" and end event (Stop) is defined as "Terminate end
event". We can test the workflow immediately in Flow Monitor (in "Flows for APEX" applcation).
Save flow as CH17. Then, navigate to Flow Monitor. Click "Create instance" button (see Figure
17.4).
Select model (CH17) and enter distinct name of the instance of the flow CH17 (see Figure
17.5). New instance appears. Click the indicated icon in Figure 17.6 and select "Start". The status
of the instance will change to "running". Click "Details" for demo instance. Set side-by-side
display settings to and click "Complete" in column "Quick Action" (see Figure 17.7). Now, the flow
proceeds with parallel gate and two tasks (see Figure 17.8). Click "Complete" in column "Quick
Action" for both tasks and proceede with the final task. Repeat completion for the last task and the
instance is completed (see Figure 17.9). Entire history of the instance will be presented by clicking
"Show history". We have proved, that the workflow CH17 is executable and we can model data and
application interface.
17.6 Data model 250
ch17_employee
apex_un vc30 /nn,
firstname vc30 /nn,
lastname vc30 /nn
ch17_customer
comp_name vc80 /nn,
comp_taxid vc20 /nn,
comp_bic vc20 /nn,
comp_iban vc20 /nn,
comp_rating vc1 /check ’A’,’B’,’C’,’D’ /nn
ch17_doc_class
doc_class_desc vc512 /nn,
doc_class_short vc13 /check ’MANUFACTURING’,’FINANCIAL’,’BUSINESS’,
’OTHER’ /nn
ch17_inquiry
customer_id num /fk ch17_customer /nn,
cust_price num /nn,
17.6 Data model 252
ch17_inquiry_doc
inquiry_id /fk ch17_inquiry /nn,
17.6 Data model 253
One of the benefit of Quick SQL is its compactness and simplicity. Number of lines in Quick SQL
is half of the SQL script and number of characters is less than one a third of SQL script. Time
and effort for learning Quick SQL is good investment. APEX also provides user-friendly editor
with auto-completion, however the advantages of Quick SQL would be more utilized by user who
speaks SQL.
We will also define two stored functions which are explained as comments within the code - two
dashes at the beginning of the lines are comments. The first function is called ch17_doc_bytesize:
17.6 Data model 254
wnumdocs := wnumdocs + 1;
end if;
END LOOP;
RETURN wnumdocs;
END ch17_count_docs;
Some LOVs and Plug-ins were set up or included prior to application development in a narrower
sense.
This LOV is used on forms and reports to contribute to readability and to prevent entering
the wrong person who prepares documentation and evaluates inquiry. Concatenate operator
is used to form display string with employee first name, space and last name.
• CH17_LOV_INQUIRY: type is dynamic, based on SQL query on table CH17_INQUIRY:
SELECT
’Instance:’ || ch17_inquiry.id || ’ (Customer: ’ || comp_name || ’,
product:’ || cust_product_item as d,
ch17_inquiry.id as r
FROM ch17_inquiry, ch17_customer
WHERE ch17_inquiry.customer_id = ch17_customer.id;
This LOV is used on forms and reports to contribute to readability and to prevent entering
wrong inquiry ID. Concatenate operator is used to form display long string with a lot of
information.
from flow_task_inbox_vw
where sbfl_dgrm_name = ’CH17’ and
sbfl_current_name = ’prepare documentation’
It shows only instances of process "CH17" which have current name "prepare documentation". Two
links are provided on Page 4 in application (see Figure 17.14):
1. lens icon in "Subflow ID" column shows the state of the instance in workflow diagram (see
Figure 17.15, Page 5 in application).
2. "Sbfl Process Name" column shows modal dialog in which sales can confirm that documen-
tation is ready (see Figure 17.16, Page 7 in application). At this point, documentation is not
prepared yet (0 documents uploaded). The counter is a result of PL/SQL block as source:
BEGIN
RETURN CH17_COUNT_DOCS(:P7_INQUIRY_ID);
END;
17.7 Application interfaces 258
filtering, formatting, charting, reporting, exporting etc.). The aim of this report is to provide the
sales manager an ID of inquiry which can be used in the process of documentation preparation (i.e.
17 as indicated in Figure 17.17). Next step for the sales manager would be preparation of technical,
financial, business and other specification (see Figure 17.18, Page 8 in application). Figure 17.18
shows filtered results (inquiry ID is 17). No BLOB is uploaded - column "Ch17 Doc Bytesize(id)"
17.7 Application interfaces 259
shows all zero. Page 8 is an interactive report, based on the following SQL query:
select ID, INQUIRY_ID,DOC_CLASS_ID, CH17_DOC_BYTESIZE(ID), CONTBLB,
FMIME,FNAME, FDCR, FREFER
from CH17_INQUIRY_DOC
PL/SQL function CH17_DOC_BYTESIZE returns the size of the BLOB. Function takes the ID of
the CH17_INQUIRY_DOC as an input parameter and is defined as follows:
create or replace function CH17_DOC_BYTESIZE(xdocid in number) return number
is
wdoc_size number := 0;
wblob blob;
Begin
select contblb into wblob from ch17_inquiry_doc where id = xdocid;
wdoc_size := dbms_lob.getlength(wblob);
RETURN wdoc_size;
END;
ID of the CH17_INQUIRY_DOC table is used as a link to open a modal page (Page 9) in application
(see Figure 17.19). By refreshing Page 8, user can be assured that documents are uploaded (see
Sales would now confirm that the preparation task is finished. By opening the Sales flow
report and clicking the link on process name, the modal page opens (see Figure 17.21, Page 8 in
application). By clicking "Subflow ID", sales manager gets visual confirmation, that document
preparation task is completed (see Figure 17.22, Page 5 in application).
17.7 Application interfaces 260
Figure 17.21: Sales - report for selected instance after uploading three documents.
Figure 17.22: Sales - flow report for selected instance after uploading three documents.
Remember that page item P2_WID contains unique number, provided by sequence. So the name is
concatenated string, composed of fixed string “CH17”, space, open parenthesis, unique sequence
number, close parenthesis, space, fixed string “by - ” and current user. Select Flow is using “Static
17.9 Define user roles 262
text” and the Static text is “CH17”. Success Message is “Flow CH17 instance started.” and Error
Message is “Flow CH17 instance NOT started.”.
To present the state of the instance on Page 5 the page wizard for plug-in page is used. The
page contains viewer plug-in and hidden item - P5_PRCS_ID. See settings in Figure 17.35.
To push instance forward (i.e. Pages 7, 21, 31, 41) define page items as shown in Figure 17.36.
Only first four page items (from P7_PRCS_ID to P7_INSTANCE_NAME) are relevant to Flows
for APEX integration. Create a new process which is triggered by a button. Process is defined as
"Manage Flow Instance Step" plug-in. Set Action, Process ID Item, Subflow ID item and Step Key
as shown in Figure 17.37.
Some of them will be discovered and debugged by clever readers. Some errors are also deep inside
APEX itself. We, the writers and developers of this chapter hope that testing and debugging will
present a pleasant challenge to readers.
Removing errors from software is sometimes fun and sometimes a curse. Just do not give up
too soon!
Packaged application is tested and it will run in new workspace if the following requirements
are meet:
• privilege "create job" is granted to schema which hosts new workspace. Database administra-
tor can grant this privilege by command "grant create job to <schema>". APEX workspace is
associated with database object called schema. If you are using OCI (free, paid or provided
by Oracle Academy) than use web OCI interface (Autonomous Database > specific instance
> Database action) or enter directly web database administrator interface. You can execute
queries and scripts. Figure 17.39 presents the outlook of the interface with entered command
(1) and database response (2). If you use other tools (SQL Developer, TOAD) the procedure
is pretty much the same, except the outlook of the interface.
• Flows for APEX must be installed in new workspace (see prior instructions).
• Workflow model called CH17 is imported into Flows for APEX. File CH17.bpmn is stored
in directory Flows4APEX in packaged application as static file. Go to Shared Components
> Static Application Files and download it to your local computer. The same file is also
available in learning materials scripts. Than import file CH17.bpmn with Flows for APEX.
Log in into application Flows for APEX. Select Flow management and import the file (see
Figures 17.40 - step 1 and Figure 17.41 - step 2). The meaning of the numbers in Figure
17.41 are: 1 (arbitrary category), 2 (name of the model must be exactly CH17), 3 (navigate
your file explorer to CH17.bpmn) and 4 (confirm by pressing Import)
• After installation of the packaged application add a user role assignment (Shared components
> Application Access Control > Add User Role Assignment).
If any of the above requirements is not met then the imported application will crash. It is necessary
to clear the web browser cookie (i.e. Firefox: Settings > Cookies and Site Data > Manage Data)
after application crashes due to unmet requirements.
17.12 Questions 265
17.12 Questions
1. Explain what is Flows for APEX?
2. What are the artifacts of business process model presented with BPMN diagram?
3. Which functions by Flows for APEX were used in this application?
17.13 Answers
1. Flows for APEX is called a feature, a plug-in and an application. All three meanings are
correct. Feature is meant when we discuss in the context of process modeling. Plug-in relates
to development of custom application. Application "Flows for APEX" is aimed to design
workflows and administer the instances in the case of issues.
2. Artifacts of business process model presented with BPMN diagram are:
• Start Event: Indicates the starting point of a process.
• Task: Represents a single unit of work, such as an activity or a step in the process.
• Gateway: Represents a decision point in the process, such as a fork in the flow or a
17.13 Answers 266
conditional branch.
• Sequence Flow: Connects elements in the diagram and represents the flow of control
from one element to another.
• End Event: Indicates the end of a process.
• Pool/Lane: Represents a grouping of related tasks, used to define the roles and respon-
sibilities of different participants in the process.
• Message Flow: Represents the flow of messages between participants in a process, such
as a communication between two systems.
• Data Object: Represents a piece of data that is used or produced in a process, such as
an invoice or a customer record.
• Data Store: Represents a container for storing data that is used or produced in a process,
such as a database or a file system.
3. To start instance, action "Create and Start" was used. To present instance on BPMN diagram,
plug-in page wizard used Viewer component. To push forward to next step the component
"manage Flow Instance Step" was used in application.
17.13 Answers 267
Figure 17.38: Define roles and user roles in Application Access Control menu.
Figure 17.40: Import workflow called CH17 into Flows for APEX - step 1.
17.13 Answers 270
Figure 17.41: Import workflow called CH17 into Flows for APEX - step 2.
18. GreenDi – Exchange of Plants and Seeds
Extensions:
• List of offers (report)
• Details of the offer (new or existing)
• Chat (list of messages)
18.7 Questions
1. How could we make the offer visible with a delay, from a certain moment, when the bidder
wants it?
2. Can this app be used to chat about a topic other than actually exchanging plants and seeds?
How?
3. In table CH18_OFFER, the column VALID_TO has CHAR datatype. What are the potential
problems if a date is defined as CHAR type?
18.8 Answers
1. First, we would add a column in CH18_OFFER table. Than we would correct the form which
enables entering new offers. Finally, we would correct the query on offers report by adding
condition (where new_column <= SYSDATE).
2. Theoretically, it is possible. The moderator of the chat should open a dummy offer, and all
users who come in with their dummy counteroffer could participate in the chat.
3. Storing dates as CHAR can introduce data integrity issues, sorting problems, limited date
operations, formatting difficulties and some other problems. It is generally recommended to
use the appropriate date data types provided by Oracle, such as DATE or TIMESTAMP, for
accurate and efficient date storage and manipulation.
18.8 Answers 276
Extensions:
• Book insert
• Interactive report per book
• Book reviews
• Comments on reviews
4 ch19_book_user
5 profile_name vc256
6 firstname vc256
7 lastname vc256
8
9 ch19_book_data
10 title vc256
11 authors vc256
12 about vc1024
13 publisher vc256
14 publication_date date
15 rating_count num
16 category_id / fk ch19_category
17
18 ch19_book_review
19 review vc1024
20 review_date date
21 review_score num / check 1 ,2 ,3 ,4 ,5
22 book_id / fk ch19_book_data
23 user_id / fk ch19_book_user
24
25 ch19_review_comment
26 rev_comment vc1024
27 rev_comm_date date
28 rev_helpfulness vc256
29 rev_comm_score num / check 1 ,2 ,3 ,4 ,5
30 review_id / fk ch19_book_review
31 user_id / fk ch19_book_user
The code is very dense. However it requires the basic knowledge of data modeling and syntax
of Quick SQL.
Name the application, select all Features and click Generate Application (see Figure 19.5).
Working prototype of the application is now prepared. From now on functions for administrator
and end user will be presented. So far not a single line of code was written by developer (with the
exception of Quick SQL) and no application interface was tailored by developer. The actual code
behind the application was assembled entirely by APEX wizards.
Figure 19.6 shows the form for entering a new book by the administrator.
Figure 19.7 shows the form for inserting the book category by the administrator.
19.5.2 User
Figure 19.8 shows the user registration form.
Figure 19.9 shows the browsing and adding reviews.
Figure 19.10 shows form to comment a review.
Reports are by default tabular. End user can generate graphs without programming, using just
built in wizard. See Chapter 8 for transforming reports to graphs.
19.6 Define user roles 285
19.8 Questions
1. Why was in this case used Quick SQL script?
2. How can you generate multiple forms and reports in one shot?
3. How can you authorize APEX application user within application itself?
19.9 Answers
1. Quick SQL script was introduced to speed-up development of the data model. Quick SQL
script generates SQL script upon request. SQL script is executable i.e. it creates database
objects like tables and views.
2. It is possible to generate multiple forms and reports in one shot by writing the script which
contain definition of several tables.
3. To authorize APEX application user within application itself, the application must be gener-
ated with Access Control Feature. Than authorized user (Administrator) can add other users
with Administrator, Contributor and Reader roles.
20. Bill-of-material and cost calculation
Table 20.1: Use case description: report and maintain basic data.
Keyword Value
ID: Ch20-01
Title: Report and maintain basic data
Description: The manager uses the APEX application to report and maintain (select,
update) basic data whether it is a product, semi-product, material or
inquiry. Materials and aggregates are described with same set of attributes.
Updating prices of materials will not trigger re-calculation of the prices
of the aggregates in which material is used. Customer inquiry can be
composed of several products and semi-products. The unit of measure for
quantity in this case will be piece.
Primary Actor: Manager
Preconditions: Manager has account for APEX application.
Postconditions: After reporting or maintaining data another action can be taken including
BOM calculation.
Main Scenarios
Success Scenario:
1. Open the web browser and sign-in to the application.
2. Select menu item or page navigation "Prod./Semi/Material".
3. To edit scroll down the page or filter data to find specific product,
semi-product or material.
4. Click on pencil icon for specific product, semi-product or material
and update data.
5. Click "Apply changes".
Extensions: none
Frequency of Use: average 5 per day
Status: Finished
Owner: Manager
Priority: high
Table 20.2: Use case description: report and maintain structure data.
Keyword Value
ID: Ch20-02
Title: Report and maintain structure data
Description: Manager uses APEX application to report (view selected data) and main-
tain (insert and delete) the structure of products, semi-products and ma-
terial. Customer inquiry can be composed of several products and semi-
products. Inserting new items or deleting existing items will not trigger
(re)calculation of the prices of the aggregates.
Primary Actor: Manager
Preconditions: Manager has account for APEX instance.
Postconditions: After reporting or maintaining data, another action can be taken including
BOM calculation.
Main Scenarios
Success Scenario:
1. Open the web browser and sign-in to the application.
2. Select menu item or page navigation "Bill-of-material".
3. To add a component click "Create" button.
4. To delete an item in the structure click "Delete".
Extensions: none
Frequency of Use: average 30 per month
Status: Finished
Owner: Manager
Priority: high
20.3 Use cases 291
Extensions: none
Frequency of Use: average 30 per month
Status: Finished
Owner: Manager
Priority: high
20.4 Data model 292
integrity.
6 ch20_bom / unique
7 subprt_id num / fk ch20_psm / nn ,
8 aggreg_id num / fk ch20_psm / nn ,
9 quantity num / nn
Click generate SQL. Tables have the same properties as the tables generated in Oracle Data
Modeler (see Figure 20.5). Take a look at the lines 26 and 27. These two lines, although correct
will be edited later. Click Save SQL Script and Review and Run. Replace lines 26 and 27 (create
two indexes) and replace with one statement:
Now run the script. Two tables and one unique index will be generated. Note that running this
script will not be successful if you already run script generated with Oracle Data Modeler. The
reason is that data base objects already exist.
To create function enter the following text in SQL Workshop > SQL Commands:
20.4 Data model 296
17 is
18 v_rezult NUMBER (38 , 2);
19 v_psm NUMBER ;
20 v_price NUMBER (38 , 2);
21 e_negative_price EXCEPTION ;
22 CURSOR c_ds IS
23 WITH STRUK ( hier , subprt_id , aggreg_id , quantity ) AS
24 ( SELECT 1 AS hier , subprt_id , aggreg_id , quantity
25 FROM CH20_BOM JOIN CH20_PSM ON subprt_id = CH20_PSM . ID
26 WHERE aggreg_id = xpsm
27 UNION ALL
28 SELECT hier +1 , C1 . subprt_id , C1 . aggreg_id , C1 . quantity
29 FROM CH20_BOM C1 JOIN CH20_PSM P ON C1 . subprt_id = P . ID
30 JOIN STRUK C2 ON C1 . aggreg_id = C2 . subprt_id )
31 SELECT hier , subprt_id , aggreg_id , quantity
32 FROM STRUK ORDER BY hier DESC , aggreg_id , subprt_id ;
33 BEGIN
34 ystatus := 0;
35 v_rezult := 0.0;
36 v_psm := 0;
37 SAVEPOINT old_state ;
38 FOR r_ds IN c_ds LOOP
39 v_price := CH20_GET_PRICE ( r_ds . subprt_id );
40 IF ( v_price <= 0 ) THEN
41 RAISE e_negative_price ;
42 END IF ;
43 IF ( r_ds . aggreg_id = v_psm ) THEN
44 v_rezult := v_rezult + v_price * r_ds . quantity ;
45 UPDATE ch20_psm SET price = v_rezult WHERE ID = r_ds . aggreg_id ;
46 ELSE
47 v_psm := r_ds . aggreg_id ;
48 v_rezult := v_price * r_ds . quantity ;
49 UPDATE ch20_psm SET price = v_rezult WHERE ID = r_ds . aggreg_id ;
50 END IF ;
51 END LOOP ;
52 COMMIT ;
53 ystatus := 1;
54 yprice := v_rezult ;
55 EXCEPTION
56 WHEN e_negative_price THEN
57 ROLLBACK TO old_state ;
58 ystatus := 0;
59 yprice := -505;
60 WHEN OTHERS THEN
61 ROLLBACK TO old_state ;
62 ystatus := 0;
63 yprice := -100;
64 end CH20_CALCULATE_BOM ;
This procedure will return the status of calculation and the price (product, semi-product, material,
inquiry) for given ID unless any component has negative value. If something unexpected happens
20.5 Application interfaces 298
with the data base (lost connection, server down, hardware error, no data for specified ID) then
negative value will be returned. If the reader is not familiar with PL/SQL it would be enough
to read comments in procedure. Otherwise rather complex cursor is created with common table
expression (WITH statement). This cursor returns union of two sets. It provides complete structure
of aggregate which is ordered from bottom to top. The prices of intermediate aggregates are stored
in corresponding rows and cumulated till all rows in cursor are processed.
The last object to be created is trigger. The trigger will ensure that no aggregate and sub part in
bill of material cannot have the same value (car is composed of car) and traversal relation is created
(if car is composed of wheels than wheel cannot be composed of cars). To create the trigger which
implements stated rules enter the following text in SQL Workshop > SQL Commands:
1 create or replace trigger CH20_TRG_BOM_RULES
2 before insert or update on ch20_bom
3 for each row
4
5 declare
6 xsubprt numeric :=: new . subprt_id ;
7 xaggreg numeric :=: new . aggreg_id ;
8 xcount numeric ;
9 begin
10 select count ( subprt_id ) into xcount from ch20_bom
11 where subprt_id = xaggreg and aggreg_id = xsubprt ;
12 if xsubprt = xaggreg or xcount > 0 then
13 : new . subprt_id := null ;
14 end if ;
15 end ;
With this trigger we will prevent inserting by forcing NULL value in a table field which must have
value. The precedence of NOT NULL definition in the table column over the trigger mechanism
will cause that no data inserted if this business rule is violated. However we protected the hierarchy
to become cycle in a graph (term from a graph theory). If we skip the creation of this trigger we
should train end user not to fall into cycle trap. It is much better to prevent than to heal, right?
Next two figures (20.7 and 20.8) present the sketches of report and form for products, semi-
products, materials and inquiries. Inserting, updating and deleting is available.
Further two figures (20.9 and 20.10) present the sketches of report and form for structure, bill
of material. Inserting, updating and deleting is available.
Sketch (20.11) presents the interface to perform a calculation of any aggregate (semi-product,
product, inquiry). User first selects an item and then presses Calculate button. The status of
calculation and calculated price is displayed as a pop-up and tree component is shown. User can
expand and collapse hierarchy.
20.7 Questions
1. How would you change logical data model to implement new entity for units of measure,
because we want to include tens of units?
2. How would specify Quick SQL to reflect the above change?
3. What will be the consequences of dropping unique index ch20_bom_ui?
20.8 Answers
1. We apply new entity ch20_uom and set at least two attributes (ID and description of the unit
of measure). Than we set 1-to-many relation between ch20_psm and ch20_uom.
2. In Quick SQL we first define table ch20_uom as:
20.8 Answers 301
ch20_uom
description vc80
ch20_psm
description vc80 /nn,
unit_of_measure num /fk ch20_uom
price num
3. Dropping unique index ch20_bom_ui would enable to store multiple pairs (sub part, ag-
gregate) with the same values. Table would consume more disk space. The calculation
functionality would not be affected, however processing would take longer and more RAM
would be consumed.
21. Nutrition and diet management
Table 21.1: Use case description: delete the particular recipe comment
Keyword Value
ID: Ch21-01
Title: Delete or change the user comment.
Description: The administrator selects particular user comment and decides to delete
the post entirely or edits it. Deleting cause that the comment is removed
from database, while editing will cause the changes in the comment text.
The administrator acts according to published policy of the web site.
Primary Actor: Administrator
Preconditions: User has administrator role in this APEX application.
Post conditions: After deleting there is no comment stored in database. After updating
redacted comment is stored in database.
Main Scenario
Success Scenario:
1. Open your web browser and sign in to the application.
2. Select comments from the menu or page navigation.
3. Select particular comment and click the pencil icon.
4. To edit the comment, change the text and click the Apply changes
button.
5. To delete the comment, click on the Delete button twice.
Extensions: None
Frequency of Use: The administrator is expected to delete or change 100 user comments per
week upon request by internal regulator.
Status: Finished
Owner: Administrator
Priority: high
21.4 Data model 305
Extensions: None
Frequency of Use: The registered user is expected to add one new comment per week.
Status: Finished
Owner: Registred user
Priority: moderate
21.4.3 QuickSQL
To write Quick SQL code, we must first access the SQL Workshop > Utilities > Quick SQL.
Tables are defined in Quick SQL as follows:
CH21_USER
email vc200 /unique
nickname vc30 /unique
CH21_CATEGORY
category_name vc255 /nn
CH21_RECIPE
title vc255 /nn
minutes_to_prepare num /nn
implementation_type vc50 /check cooking frying baking assembling
person_portion int
steps_to_prepare vc2048
calories_recipe num
vegan vc1 /check Y N
21.4 Data model 307
Table 21.4: Use case description: prepare customised nutrition report on recipe
Keyword Value
ID: Ch21-04
Title: Prepare customised report on recipe.
Description: Preparing customised nutrition report include: optionally set filter on data
to get facts about one recipe only, select and reorder the columns, option-
ally format control break and application of aggregates to selected columns
of interest. Default report show all recipies, all ingredient with quantities,
names, unit of measures nutritional facts, chemical elements and vitamins.
Default control break is concatenated info string (title of the recipe, ap-
proximate calories, vegan, gluten and number of persons). All nutritional
facts, chemical elements and vitamins are calculated (quantity multiplied
by property value with stored unit of measure). Default aggregation is
applied on ingredient calories. Therefore the sum may differ from info
string.
Primary Actor: any user including public access
Preconditions: User navigates browser to specified page of this APEX application. URL of
the page is constructed with apex-instance-name, /ords/r/workspace name,
application name and page name.
Post conditions: None.
Main Scenario
Success Scenario:
1. Open your web browser, optionally sign in to the application and
navigate to Nutrition report page.
2. To select and/or reorder columns click Actions > Columns. Select
and/or reorder columns in subpage.
3. To aggregate any other numeric column, Click Actions > Data
> Agregate. Select Sum function and the columns of interest in
subpage. Authenticated users can store customised report.
Extensions: None
Frequency of Use: Expected number of users is 1000 per day.
Status: Finished
Owner: Public user
Priority: high
21.4 Data model 308
vitamin_c_mg num
magnesium_mg num
calcium_mg num
iron_mg num
potassium_mg num
photo blob
mimetype vc20 /check ’image/png’,’image/jpg’,’image/jpeg’
filename vc100
CH21_RECIPE_INGREDIENT
recipe_id num /fk CH21_RECIPE
ingredient_id num /fk CH21_INGREDIENT
ingredient_quantity num /nn
QuickSQL script include all references to foreign keys (clause fk, NOT NULL declarations and
check constraints that define domain for certain data fields.
Utility xxd generates hex dump which is passed to tr. The later deletes all newline characters. The
output is saved as file - honey.hex. The example in Figure 21.7 shows creation of hex dump file in
WSL. Also first 200 characters of the output is shown with command cut. Command ls was used to
check the lenghts of original png and hex files.
21.5 Preparing data for testing in spreadsheet 311
alization Attributes set date, time and timestamp formats to show also hours and minutes (i.e.
DD-MON-YYYY HH24:MI).
21.6.3 Authorization schemes, application access control, roles and user role
assignments
In application developer mode select Shared Components > Authorization Schemes. Create three
new authorization schemes: AS_ADMIN, AS_CHEF and AS_REGUSER. First will adress appli-
cation administrators, second chefs and the third registred users. Click Create button, select From
Scratch, Next, name the scheme, select scheme type as Is in Role or Group, enter error message
and click Create Authorization Scheme button. Enter data for all reguired authorization schemes
(AS_ADMIN, AS_CHEF and AS_REGUSER). Figure 21.13 show creation of authorization scheme
AS_REGUSER.
Proceed with Application Access Control. Add roles ADMIN, CHEF and REGUSER with
corresponding static identifiers of authorization scheme (see Figure 21.14).
Finally set user role assignments by clicking Add User Role Assignment button. We already
created users. For testing purposes we assign user [email protected] application role ADMIN,
user [email protected] application role CHEF and user [email protected] application role
REGUSER (see example in Figure 21.15). APEX let you know that Application users are not
exported as part of your application. When you deploy your application you will need to manually
21.6 Application interfaces 314
Figure 21.9: Loading data - pasted content from the sheet ch21_ingredient.
manage your user to role assignments. Roles are exported as part of an application export and
imported with application imports. You should have set user role assignments as presented in
Figure 21.16.
body {
background-image:
21.6 Application interfaces 315
url("#APP_FILES#pexels-pietrozj-671956.jpg");
background-size:1700px 900 px:
}
Save the changes, run application and see that background image appears on the login page. If you
attempt to use any of previously created users than you will have to change default password you
set.
Users that have CHEF or REGUSER role view only nickname column on User Report page
while User Editor page is not accesible to them (see Figure 21.22)
Requirements 1 and 2 in Table 21.5 are now satisfied.
21.6.7.2 Category management
Apply pattern used in user management. Category Report (page 5) and Category Editor (page 6)
are based on SQL Query:
• change BLOB Attributes: (Table Name: CH21_RECIPE, BLOB Column: Photo, Primary
Key Column 1: PHOTO, Mime Type Column: MIMETYPE, and File name Column: FILE-
NAME)
On Recipe Editor make additional changes:
• set page item P7_CATEGORY Select List (Shared Component LOV_CATEGORY)
• set page item P7_AUTHOR Select List (Shared Component LOV_AUTHOR)
• set page item P7_SOURCE Select List (Shared Component LOV_SOURCE)
• set page item P7_IMPLEMENTATION_TYPE Select List
(Shared Component LOV_IMPLEMENTATION_TYPE)
• set page item P7_VEGAN Select List (Shared Component LOV_YES_NO)
• set page item P7_GLUTEN Select List (Shared Component LOV_YES_NO)
Figures 21.24 and 21.25 shows the Recipe Report and Recipe General Editor as seen by CHEF
user.
To prevent other users (except with CHEF role) to display the item in navigation menu enter
Shared Components > Lists > Navigation Menu > Recipe Report and enter Authorization Scheme
AS_CHEF.
21.6.7.4 Ingredient management
Apply pattern used for recipe management. Users with CHEF role can access Ingredient Report
(page 8) and Ingredient Editor (page 9). Report is based on SQL Query:
21.6 Application interfaces 320
select ID,
INGREDIENT_NAME, UNIT,CALORIES_INGREDIENT,TOTAL_FAT_G, CHOLESTEROL_MG,
SODIUM_MG,TOTAL_CARBOHYDRATE_G, FIBER_G, PROTEIN_G, VITAMIN_D_IU,
VITAMIN_A_IU, VITAMIN_C_MG, MAGNESIUM_MG, CALCIUM_MG, IRON_MG,
POTASSIUM_MG, sys.dbms_lob.getlength(PHOTO)PHOTO, MIMETYPE, FILENAME
from CH21_INGREDIENT
The outlook of the pages are shown in Figures 21.26 and 21.27.
21.6.7.5 Recipe Ingredient management
While managing general data on recipe is already implemented adding, changing and deleting
ingredients in the recipe is not. Therefore interactive report Recipe Ingredient Report (page 10) is
created along with modal form Recipe Ingredient Editor (page 11). Start with Create Page wizard,
select table CH21_RECIPE_INGREDIENT as a Source Type. When both pages are created, make
the following changes on Recipe Ingredient Report (page 10):
• change Source Type in Body (Recipe Ingredient Report) from Table to SQL Query:
select ri.ID,
r.TITLE,
i.INGREDIENT_NAME,
21.6 Application interfaces 321
ri.INGREDIENT_QUANTITY,
i.UNIT
from
CH21_RECIPE_INGREDIENT ri, CH21_RECIPE r, CH21_INGREDIENT i
where ri.INGREDIENT_ID = i.ID and ri.RECIPE_ID = r.ID
Synchronize Columns for Body and Columns.
• apply authentication scheme AS_CHEF to entire page 10
• modify Format of quantity to 9999.99
The only modification on Recipe Ingredient Editor (page 11) would be setting of authentication
scheme AS_CHEF to entire page 11. Interactive report also offers filtering to select ingredients in
one recipe only (see Figure 21.28). That make editing of the ingredient in recipe more user friendly.
Once the recipe ingredient is determined all changes are possible (update, delete). See Figure
21.29.
This approach requires minimum programming. There are also other options in APEX to
implement more complex and all-in-one solutions (i.e. Master Detail form, JavaScript) but they
require more detailed knowledge in topics.
21.6.7.6 Coments management
There are two pages: Comments (page 12) and Comment Editor (page 14). Comments page (page
12) is generated with wizard as interactive report and later modified:
• report is based on SQL Query:
21.6 Application interfaces 322
Figure 21.19: Create User Report (page 2) and User Editor (page 3).
• column P14_COMMENT_DATE Type is set to Display only. Format mask is set to DD-
MON-YYYY HH24:MI. Default value Type is set to SQL Query (return single value),
SQL Query is:
Comment Editor entry in Navigation bar is set to Authorization Scheme AS_ADMIN to prevent
other roles to be displayed.
The outlook of the Comments page is presented separately for ADMIN and REGUSER role in
Figures 21.30 and 21.31.
Comment Editor for ADMIN users is presented in Figure 21.32.
Figure 21.21: User Report and User Editor for ADMIN role.
• select Actions > Data > Aggregate Sum on Calories Ingredient, Total Fat G, Cholesterol Mg,
Sodium Mg, Total Carbohydrate G, Fiber G, Protein G, Vitamin D Iu, Vitamin A Iu, Vitamin
C Mg, Magnesium Mg, Calcium Mg, Iron Mg and Potassium Mg.
• select Actions > Report > Save Report as Default Report Type Primary
• select Actions > Columns and choose and reorder columns, save named reports according to
your preference
One might show all data on Primary Report and prepare three named reports such as Elements,
Vitamins, Nutrition (see Figures 21.34 and 21.35)
Figure 21.23: Category Report and Category Editor for CHEF role.
21.8 Questions
1. How can you change the background in your log in page?
2. Where else can we find role management in Oracle APEX environment if it is not enabled in
our app?
3. How can you configure the button name of a report?
4. How can you change the page name after creating it?
21.9 Answers
1. In your app environment, choose Shared Components then choose Static Application Files
click on Create File and in the pop up window add the image of your preference. Then copy
the reference name of the image, go back to your app environment and choose 9999-Login
Page, go to css field and type in inline
body {
background-image:
url("#APP_FILES#\textit{the reference name of the image}");
21.9 Answers 326
2. In your app environment, choose Shared Components then choose Application Access
control.
3. To change the label of the Create button to a different name, you should enter the Page
Designer of the report, locate the Create button, and change the label in the Identification
field.
4. To change the name of a page that you have created, log in to your app and click on Quick
Edit. Then, click on the page title and select the arrow in the source area of the breadcrumb.
Next, click on Edit Component, and in the Short Name field, update the name to the desired
new name. Finally, click on Apply Changes, and the new name will appear in the page title.
21.9 Answers 327
Extensions: -
Frequency of Use: Approximately 4 out of 30 obligatory dates in one academic year.
Status: [Finished]
Owner: User with the teacher privileges
Priority: moderate
• Student enrollment for office hours consists of overview of calendar (all office hours offered
by all teachers engaged in student-s study program), selecting desired office hours, entering
the purpose and confirming enrollment. It is not allowed to enroll more than once per
scheduled office hours.
Table 22.2: Use case description: student enrollment for office hours.
Keyword Value
ID: Ch22-02
Title: Student enrollment for office hours
Description: Student uses APEX application to enroll office hours. The calendar has
all scheduled office hours for all teachers that are engaged with student
study programs (departments). Usually one student is enrolled to one
study program, but exceptional individuals may be permitted to study two
or more. Application will prevent multiple enrollments of one student to
specific office hours.
Primary Actor: student
Preconditions: access to web browser on mobile device or PC, user has teachers credentials
and privileges, application web site is available
Postconditions: data stored in data base in table ch22_dh_slot
Main -
Success Scenario:
1. student opens the web browser and sign-in to the application
2. enroll through calendar
3. click the desired slot (slots are colored indicating the statuses)
4. on new form student clicks the button and confirms the enrollment
Extensions: -
Frequency of Use: Over 1000 students use office hours at on average 2 times per semester for
10 to 15 teachers.
Status: [Finished]
Owner: Student
Priority: high
22.4 Data model 335
12 CH22_DUTY_HOUR CH22_DUTY_HOUR ,
13 CH22_STUDENT CH22_STUDENT ,
14 CH22_TEACHER CH22_TEACHER ,
15 CH22_LOCATION CH22_LOCATION
16 where CH22_DH_SLOT . SLOT_ID = CH22_DUTY_HOUR . ID
17 and CH22_DUTY_HOUR . LOCATION_ID = CH22_LOCATION . ID
18 and CH22_DUTY_HOUR . TEACHER_ID = CH22_TEACHER . ID
19 and CH22_STUDENT . ID = CH22_DH_SLOT . STUDENT_ID
By adding additional condition at the end "and CH22_TEACHER.EMAIL = :APP_USER" the
query will return enrolled student for that specific teacher. Query Builder would be necessary
feature for absolute beginners but experienced users can also benefit using it.
Queries used in this application utilize concatenation operator (||), EXTRACT function, common
table expressions, fetching first 10 or 5 rows only, custom build function CH22_dh_utilization.
Readers of this book may benefit by installing packaged application first and examine queries used
on calendars, dashboard and reports.
.fc-event.my-cal-blue {
background-color: lightblue;
border: 0.5pt solid black;
opacity: 0.7;
}
.fc-event.my-cal-blue .fc-event-title {
color: darkblue;
font-weight: bold;
}
.fc-event.my-cal-orange {
background-color: orange;
border: 0.5pt solid black;
opacity: 0.7;
}
.fc-event.my-cal-orange .fc-title {
color: darkred;
22.6 Supplementary learning material 341
font-weight: bold;
}
.fc-event.my-cal-dark-orange {
background-color: #8B5A00;
border: 0.5pt solid black;
opacity: 0.7;
}
.fc-event.my-cal-dark-orange .fc-title {
color: white;
font-weight: bold;
}
.fc-event.my-cal-white {
background-color: white;
22.6 Supplementary learning material 342
.fc-event.my-cal-white .fc-title {
color: black;
font-weight: bold;
}
.fc-event.my-cal-green {
background-color: lightgreen;
border: 0.5pt solid black;
opacity: 0.7;
}
.fc-event.my-cal-green .fc-title {
color: darkgreen;
font-weight: bold;
22.6 Supplementary learning material 343
Figure 22.12: Calendar of all office hours offered by teachers in student’s study program.
Figure 22.13: Enrollment to office hours through calendar - picking calendar slot.
SELECT
EXTRACT(YEAR FROM start_date) || ’-’ ||
EXTRACT(MONTH FROM start_date) AS "Year and Month",
COUNT(id) AS count
FROM ch22_duty_hour
GROUP BY EXTRACT(YEAR FROM start_date),
EXTRACT(MONTH FROM start_date)
order by 1;
Figure 22.14: Enrollment to office hours through calendar - selecting the purpose.
Figure 22.16: Checking the enrollment through the "View my appointments" menu item.
See other queries for pages which are based on calendar element in the packaged application.
22.7 Questions
1. How to add a user with teacher rights?
2. How would you enhance application by enabling student to take notes for particular meeting?
3. How would you limit query results to rows which have date columns equal or greater than
current time?
22.8 Answers 346
Figure 22.19: Teacher calendar with visible student names, their languages and purposes.
22.8 Answers
1. Use Manage Users and Group. Add new user. Use SQL Workshop > Object Browser and
select table CH22_TEACHER. Select "Data" tab and "Insert row". Email of inserted row
must match created APEX user.
2. Create new table i.e. CH22_NOTES with fields: ID, note and DH_SLOT_ID as a foreign
key which references table CH22_DH_SLOT. Create new report and form for student and
authorize the page for student. Depending on institutional rules you can grant teachers the
right to view or modify student notes.
3. To limit query results to rows which have date columns equal or greater than current time the
condition WHERE date_column >= SYSDATE must be added.
22.8 Answers 347
Figure 22.20: Rescheduling teacher office hours with NONE enrolled - the calendar view.
Figure 22.21: Rescheduling teacher office hours with NONE enrolled - new date entered.
Figure 22.22: The results of rescheduling teacher office hours with NONE enrolled.
23. Telco case
Extensions: -
Frequency of use: Customer changes a set of services approximately once per six months
Status: Finished
Owner: Customer
Priority: high
Extensions: -
Frequency of use: Customer demand an insight approximately once per month
Status: Finished
Owner: Customer
Priority: high
• LDAP server,
• Oracle APEX account,
• Social platform login,
• Custom.
In the Oracle APEX tool, we choose the authentication method - Authentication Scheme - in
the Shared Components \ Authentication Schemes sub page. In this sub page, we find a list of
existing login schemes, and we can also create a new login scheme here. When creating a new
scheme, we can choose one of the above-mentioned authentication methods. For the needs of our
application, we chose the most general method, Custom.
The main part of Custom authentication is the so-called authentication function. The input to
this function is the username and password the user enters on the login page, and the output is a
boolean value. As expected, the function returns true if the given name and password match an
existing user and false otherwise. In Listing 23.1, we can see a header of such a function. Therefore,
when creating a Custom login scheme, we need to provide the name of such a function. That is,
such a function must already exist.
CREATE OR REPLACE FUNCTION authenticate_user
(p_username IN varchar2,
p_password IN varchar2)
RETURN boolean;
Listing 23.1: Header of an authentication function.
We implement the body of the authentication function using the PL/SQL language, i.e., it is
up to us to decide how we authenticate the user. That is the reason why the Custom method is
the most general. We can, for example, contact an external authentication service using REST
API, search for a user in a local database, or leave authentication to another local process. In our
application, we have chosen the commonly used procedure of searching and verifying the user in
the local database.
23.5 User authentication and user roles 352
We can see the CH23_Person table in the data model we presented above. The email and
password columns are relevant for authentication. The user’s email also serves as a unique
login name. The password column contains user passwords stored in a secure hashed form. The
description of secure password storage is beyond the scope of this chapter. The reader can find out
more about it in the literature. Nevertheless, before entering data or editing the password column
in the CH23_Person table, it is necessary to hash the password. For this purpose, we created an
auxiliary function hash_password, the header of which we can see in Listing 23.2. This function
takes the username and password in plaintext form and generates a password in a secured hashed
format which can be stored in the database.
hand, the advantage is that we, the application developers, control the entire authentication process.
Another advantage is that the implementation used is easily scalable. If, for example, we would
like to use an external service for authentication in the future, we would need to change the
implementation of the authentication function so that it contacts the external service instead of the
local database.
The second important task related to user management is user role management. While the
login process was the same for all users, we needed to make different parts of the application
access based on the user’s role when managing roles. Role management is closely related to user
management. First, all possible user roles must be specified in the Oracle APEX environment. We
can find role management in the Shared Components \ Application Access Control subpage. In
this subpage, we see a list of existing roles, and we can also create a new role here. For each new
role, it is necessary to specify its static identifier, which we will use later when assigning the role to
individual users. In our application, we use roles with the following static identifiers:
• ADMIN,
• CUSTOMER,
• MANAGER.
We assign a role to a user using PL/SQL code. In Listing 23.3, we can see a sample code for
assigning the role CUSTOMER (static role identifier) to the user [email protected].
We used another set of triggers for the Person table to automate this process. The Role column
23.6 Application interfaces 354
in this table can take values from the set {’a’, ’m’, ’c’} that agree with the initial letters of the
above-defined roles. In the body of the trigger, before inserting or updating data, we set the
appropriate role for the given user according to the value of the Role column using code similar to
the code in Listing 23.3.
Listing 23.3: PL/SQL Code that associates a given user with a given role.
APEX_ACL.REPLACE_USER_ROLES (
p_application_id => 151905,
p_user_name => ’[email protected]’,
p_role_static_ids => wwv_flow_t_varchar2(’CUSTOMER’) );
RETURN boolean;
The last step of implementing user roles in the application is to display different subpages
based on the logged-in user’s role. For each subpage that is intended only for a specific user role, it
is necessary to select the user role for which the given subpage is intended in the Page Designer
settings of the page in the Security \ Authorization Scheme section. This step ensures that users
with other roles cannot access that subpage. For example, the Home page of our application is
specific in that it does not require a login to view it. We also set this behaviour in the Security
section with the Authentication item, where we select the Page Is Public option.
The settings described above will ensure that the user only has access to the subpages of his
role. However, all users will still see all subpages in the navigation menu - even those they do not
have access. Such behaviour is certainly not desirable. For the application to show users only the
subpages to which they have access, it is necessary to adjust the navigation menu settings. We can
set this in the Shared Components \ Navigation and Search \ Navigation Menu subpage. Here,
in the Authorization Scheme column for each item in the menu, it is necessary to set the user role
to which the given item will be displayed.
we can easily display minutes called up during individual months, the number of SMS sent, or the
amount of transferred data in the ordered program.
23.7 Scripts
Please find required scripts for sequences (CUSTOMER_SEQ and PERSON_SEQ), triggers
(BI_CUSTOMER, BI_PERSON and BU_PERSON ) and functions (HASH_PASSWORD and
AUTHENTICATE_USER) are provided in learning resources.
current price of consumed units of flat rate and extras. The SQL query is used to obtain these data.
You can find scripts for consumed units of flat rate and consumed units of extra services in learning
resources (file CH23_QUERY.sql).
The Buy extra region contains a number field, a select list, and a button. It is possible to set an
amount and to select which extra service we want to buy. It is operated using a button that executes
a process running a PL/SQL code (INSERT INTO CH23_EXTRASERVICE VALUES (:BUY_TYPE,
(SELECT customerid FROM CH23_CUSTOMER JOIN CH23_PERSON USING (personid) WHERE
email = :APP_USER), sysdate, :BUY_AMOUNT);)
The Show invoices region consists of a button used for generating invoices. In the Behaviour
property of the button, we have defined Action, which was set as Redirect to Page in this Application.
Then we set Target to a predefined customer invoice page, which was set to be modal. On this page,
a classical report, which can also be printed, is displayed using an SQL query provided in learning
resources (file CH23_QUERY.sql, query for an invoice report).
The Log region contains an interactive report for displaying a usage log by using SQL query
provided in learning resources (file CH23_QUERY.sql, query usage log)
Tab Stats is a new page consisting of three regions, such as Minutes, SMS, and Data. The
region type is set to be Static Content, including Chart components displaying charts from series.
Its source is defined by SQL query. By default, the colour of the chart bars is set to be uniform. It
can be adjusted in SQL query (see file CH23_QUERY.sql, query Statistics) in learning resources.
• add APEX user before running application. Only in development and testing workspace
navigate to Shared Components > Application Access Control > Add User Role Assignment;
enter APEX user and set this user roles Administrator, Contributor and Reader. In production
consultation with skilled personnel before deployment in a must.
If user is not granted appropriate role than imported application will crash. It is necessary to
clear web browser cookie (i.e. Firefox: Settings > Cookies and Site Data > Manage Data) after
application crashes due to unmet requirements.
23.12 Questions
1. Which subpage is used for creating a new login scheme?
2. Name at least two authentication methods for user management.
3. Throughout the implementation, various items were referenced in the Select statements. How
can you identify those items?
23.13 Answers
1. In the Oracle APEX tool, we choose the authentication method - Authentication Scheme - in
the Shared Components => Authentication Schemes sub page.
2. There are multiple methods, which can be used for user authentication, like LDAP server,
Database account, Oracle APEX account, etc.
3. Items in the Select statements are referenced using a colon at the beginning of the item name.
23.13 Answers 358
Table 24.1: Use case description: accessing cars, customers and car rent reservation
Keyword Value
ID: Ch24-01
Title: Access to list of cars and costumers, ability to add and remove data and
create a new car rental reservation by selecting preferred dates and calcu-
lating the cost.
Description: The user will utilize the APEX application to access and view the cars
that belong to the company, as well as all of the customers who have
previously made a booking. Both cars and customers are described by a set
of attributes. Additionally, the user will have the ability to create, update,
and delete data for both categories, allowing for efficient management
of the car rental system. Furthermore the user is able to create a new
car rental reservation by adding the car, customer, and dates. The system
calculates the total cost of the reservation based on the selected dates and
updates the results accordingly. The final report presents the reservation
details, including the car, customer, rental dates, and total cost.
Primary Actor: User administrator
Preconditions: User has an admin account for APEX instance.
Post conditions: After updating and selecting a car and customer, the user will be able to
create a car rental reservation within the APEX instance. After completing
a car rental reservation and calculating the total cost.
Main Scenario
Success Scenario:
1. Open a web browser and sign in to the car rental application.
2. Select the menu item or page navigation labeled Cars or costumers.
3. To add a car, click on the “Create” button, and for customers, do the
same.
4. To edit a car or customer entry, click on the pencil symbol associated
with that specific entry.
5. To add or update data, click the “Apply Changes” button. To delete
data, click on the “Delete” button.
6. Select menu item or page navigation rent car.
7. To create a new rent click create.
8. To add car to the reservation click on carid and select from the list
of available cars.
9. To add costumer to the car reservation click on custid and select
from the list.
10. To set the dates of the reservation click on rent date and select the
preferred start date of the reservation.
11. Then click on the return date field and select the date when the car
rental will end.
12. When the car is returned, the total cost of the reservation is calculated
based on the number of days rented and any additional charges. If
there is damage to the car, an extra cost will be added to cover the
repair costs.
13. The final cost is presented to the customer along with a detailed
breakdown of charges in the rental report.
Extensions: None
Frequency of Use: The number of reservations per day varies depending on the tourist season,
but on average, we receive approximately five reservations per day.
Status: Finished
Owner: User
Priority: moderate
24.4 Data model 369
constraint ch24_rentcar_custid_id_fk
references ch24_customers on delete cascade,
rent_date date not null,
return_date date not null,
damage varchar2(50 char),
damage_cost number,
totalcost number
)
;
-- table index
create index ch24_rentcar_i1 on ch24_rentcar (carid_id);
create index ch24_rentcar_i62 on ch24_rentcar (custid_id);
provides detailed information on these entities using a friendly web-based application based on the
Oracle APEX platform, as shown in Figure 24.5.
The template in Figure 24.6 is designed for managing the information related to cars in a
car rental shop. The user, who is the owner of the shop, can store and manage all the necessary
information about the cars, such as make, model, year, fuel type, and also upload a photo of the car
to show its condition. On the following Figure 24.7, it is explained how to add a column to your car
form that will allow showing photos of the cars. To achieve this, you need two auxiliary columns to
save the information in your table, one for the mime and one for the file name. The column that will
store the photo should be set to storage type BLOB. In our case, the column name is CARPHOTO.
In the application page designer, you need to go to the report for the CAR template and configure
the CARPHOTO column as a file browser. Then change the settings of the storage type to "BLOB
column specifier in item source attributes".
Next, you need to go to the form for the CAR template and configure the CARPHOTO
column as a Display image. Configure the BLOB attributes by connecting the table GRP2-
CARS, the column CARPHOTO, and the primary key ID. Finally, the columns MIMETYPE and
FILENAME should be set to hidden.
Similarly, data related to customers can be managed (see Figure 24.8).
24.6 Supplementary learning material 373
In the rental table as shown in Figure 24.9, the user can select a car based on criteria such as
maker, model, and year. The rental is then connected to the customer and all the necessary details
needed to make a rental such as the car, customer, rental start and end dates, and the total cost will
be displayed. The user can also add an additional cost if the car has any damage after it has been
returned. Once the rental is complete, the total cost will be calculated and presented in the final
report.
24.7 Questions
1. How can you add an icon in your app logo when you have already created the app?
2. How can you add images to your report pages?
24.8 Answers 374
24.8 Answers
1. In your app environment, choose Shared Components then choose User Interface At-
tributes click on Edit in the pop up window and add the image of your preference.
2. First, you need to set the data type of your column as BLOB. Then, in the Application Page
Designer for your report template, configure the column as a file browser and change the
Storage Type to BLOB column specifier in item Source Attributes. Next, go to the form of
this template in the App Builder environment and configure the column as a Display image.
Then, configure the BLOB attributes by connecting the table, column, and primary key ID
that is related to this column.
24.8 Answers 375
Articles
[1] Hill Kim. “Altruistic cooperation during foraging by the Ache, and the evolved human
predisposition to cooperate”. In: Human Nature 13 (Mar. 2002), pages 105–128. DOI: 10.100
7/s12110-002-1016-3 (cited on page 174).
Books
[2] Roy Fielding and Richard N. Taylor. Principled design of the modern Web architecture.
Edited by Mehdi Jazayeri andAlexander L. Wolf Carlo Ghezzi. Association for Computing
Machinery, 2010. ISBN: 978-1-58113-206-9. DOI: 10.1145/337180.337228 (cited on page 95).
[3] Dariusz Jemielniak and Aleksandra Przegalinska. Collaborative society. MIT Press, 2020
(cited on page 174).
[4] OMG. Business Process Model and Notation (BPMN), Version 2.0. 2011. URL: http://www.o
mg.org/spec/BPMN/2.0 (cited on pages 243, 244).
[5] OASIS OPEN. Universal Business Language Version 2.1, OASIS Standard, 04 November
2013. 2013. URL: http://docs.oasis- open.org/ubl/os- UBL- 2.1/UBL- 2.1.pdf (cited on
page 242).
[6] A. Osterwalder and Y. Pigneur. Business model generation: a handbook for visionaries, game
changers, and challengers. Volume 1. John Wiley and Sons, 2010 (cited on pages 37, 38).
Index
logical data model, 49, 214, 222, 229, 233, second normal form, 2NF, 55
250, 273, 278, 293, 306, 335, 350, sequence, 253
369 skill level, 41
logical model, 49 small innovation system, 232
SQL aggregation, 62
multilingual, 197 SQL ALTER TABLE, 60
multiple languages, 197 SQL COUNT, 62
SQL CREATE TABLE, 60
normalization, 54
SQL data definition language, 60
object browser, 60, 61, 93 SQL data definition language, SQL-DDL, 57
office hours scheduling, 331 SQL data manipulation language, SQL-DML,
on-premise, 42 60
Oracle Academy, 47 SQL data query language, SQL-DQL, 61
ORACLE APEX, 77 SQL DELETE, 61
Oracle Cloud Infrastructure, 46 SQL Developer Data Modeler, 49
Oracle REST Data Service, ORDS, 95 SQL DROP TABLE, 60
SQL INSERT, 61
packaged application, 192 SQL JOIN, 62
page, 81, 82 SQL ORDER BY, 62, 63
page creation, 80 SQL Script, 112
page designer, 81, 82 SQL SELECT, 62, 94
page type, 81 SQL SUM, 62
PL/SQL, 193 SQL TO_CHAR(), 62
problem definition, 209, 219, 226, 232, 245, SQL UPDATE, 61
271, 277, 288, 302, 332, 348, 366 SQL WHERE clause, 61, 62
SQL workshop, 60
query builder, 63
SQL-DDL, 57, 60, 192
Quick SQL, 59, 61, 109, 192
SQL-DQL, 61
RDB, 51 stateless REST, 95
RDB schema, 52, 54 stored function, 253
RDB schema generation, 52 structured query language, SQL, 57
RDBS schema management, 57
table, 51
region, 81
telecommunication services, 348
relation, 51
third normal form, 3NF, 56
relational data model, 214, 223, 229, 237,
251, 274, 280, 293, 306, 335, 350, use case diagram, 210, 220, 227, 233, 246,
369 273, 278, 292, 303, 333, 349, 367
relational DB schema, 51 use case, UC, 38
relational model, 49, 51 Use cases, 289
relational model generation, 52 use cases, 210, 220, 227, 232, 246, 272, 278,
relationship, 50 303, 332, 348, 367
representational state transfer, REST, 95 user authorisation, 226
resource handler, 96 user feedback, 80
resource module, 96
resource template, 96 validation, 81
REST, 95 Virtual Box Appliance, 43
RESTful access, 95
RESTful service, 95 web application, 48, 82
web application development process, 77
sample and starter apps, 184 workflow model, 249
LOW CODE PROGRAMMING WITH APEX DOI
HOW TO AND PRACTICAL CASES https://doi.org/
10.18690/um.fov.5.2024