Book Image

Oracle APEX Best Practices

Book Image

Oracle APEX Best Practices

Overview of this book

Have you ever wanted to create real-world database applications? In this book you're not only getting APEX best practices, but will also take into account the total environment of an APEX application and benefit from it."Oracle APEX Best Practices" will guide you through the development of real-world applications. It will give you a broader view of APEX. The various aspects include setting up APEX environment, testing and debugging, security, and getting the best out of SQL and PL/SQL.In six distinct chapters you will learn about different features of Oracle APEX as well as SQL and PL/SQL.Do you maximize the capabilities of Oracle APEX? Do you use all the power that SQL and PL/SQL have to offer? Do you want to learn how to build a secure, fully functional application? Then this is the book you'll need. "Oracle APEX: Best Practices" is where practical development begins!
Table of Contents (14 chapters)
Oracle APEX Best Practices
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Oracle Public Cloud


The Oracle Public Cloud is a suite of Oracle applications, middleware, and database offerings delivered in a self-service, subscription-based, elastically scalable, reliable, highly available, and secure manner.

The Oracle Public Cloud includes the following services:

  • Application Services

  • Oracle Fusion CRM Cloud Service

  • Oracle Fusion HCM Cloud Service

  • Oracle Social Network Cloud Service

Platform Services:

  • Oracle Database Cloud Service

  • Oracle Java Cloud Service

For additional information, see https://cloud.oracle.com.

The Database Cloud Service, although based on the Oracle database, is a platform as a service product rather than a database as a service product. The Database Cloud Service combines the following products:

  • Application Express

  • RESTFul web services access

  • SQL Developer

  • Packages applications

Cloud computing is a little bit misleading. For Database Cloud Service, you interact with the Oracle database.

Packaged applications

The Oracle Database Cloud Service and Application Express 4.2 include a set of business productivity applications and sample code. All of these applications are easy to use, support mobile devices, and are installable in a few clicks. Productivity applications can be unlocked for customization and learning purposes. Of course, Oracle can only provide support for locked applications. Productivity applications are not the same as sample applications, because sample applications are unlocked by default.

Examples of productivity applications are the project tracker and checklist manager. Examples of sample applications are error handling, interactive reports, and the mobile sample application.

Plan for the future

In addition to these packaged business applications and sample code, the Oracle Database Cloud Service supports third-party applications. All third-party applications will go through a validation process to ensure the safety of the application and the protection of user data in the Oracle Database Cloud Service environment (Oracle Certification).

The following screenshot shows an example of the available packaged applications:

RESTful web services

The Oracle Database Cloud Service and Application Express 4.2 include the RESTful Web Services wizard that allows you to easily create a web service to access any SQL statement or PL/SQL program. This wizard makes it easy to create RESTful web services to be used by applications outside the Database Cloud Service.

RESTful web services have three main characteristics:

  • The services use HTTP methods explicitly

  • The services are accessible through URIs

  • The services are stateless

Terminology used in the RESTful Web Services wizard are listed in the following table:

Terminology

Description

Module

The RESTful service module is used to group services.

Template

A template is identified by a unique URI, which also includes a portion based on the Database Cloud Service and the module.

Handler

A handler is based on a specific HTTP method, such as GET (select), POST (update), PUT (insert), or DELETE. You can only have one handler for each HTTP method for each template.

Source type

When you create a RESTful web service, the key attribute of the service is the source type. There are two basic categories of source types—SQL and PL/SQL.

Query

A query source type is defined as any standard SQL statement.

Query one row

The query one row source type only returns a single row from the SELECT operation.

Feed

The URL returned by the feed web service is formed by using the URI for the web service with the value for the first column in the SQL statement passed as the argument in the URI.

PL/SQL

The PL/SQL source type allows you to use any PL/SQL code to create and return data from a RESTful web service call.

The RESTful Web Services wizard

On the home page of the RESTful Web Services wizard, a report on web services modules exists. The module named oracle.example.hr is shown in the following screenshot. The home page can be reached through SQL Workshop/RESTful Web Services.

Click on the module and you will see two logical parts of the page. On the left-hand side, you will see a list of various templates within the module. On the right-hand side, you will see the attributes of this module.

The next example steps through the RESTful Web Services creation wizard are as follows:

  1. Start the wizard by clicking on Create Template, as shown in the following screenshot:

  2. Give the template a name, for example empall/.

    Note

    Remember that the forward slash at the end of the URI is required.

  3. The next step is to create the handler.

    You can do that by clicking on Create Handler just below the RESTful service (empall/):

  4. Now select the HTTP method for your RESTful service.

    The HTTP methods available here are GET (equal to select), DELETE (equal to delete), PUT (equal to insert), and POST (equal to update):

  5. From the available source types, select Query. As the output format you can choose between JSON and CSV. Select JSON.

  6. The Source field contains the source code, which will be executed when the web service is called. Enter the following query in this field:

    Select * 
    From EMP
    Order by deptno, ename
  7. Click on the Create button to save the template.

    We can test the web service by clicking on the Test button and check the outcome of the web service. An example of a possible outcome, depending on your data, is shown in the following screenshot:

    Tip

    Remark

    To have this nice layout, I installed the Firefox browser JSON viewer plug-in from https://addons.mozilla.org/en-us/firefox/addon/jsonview/.

    A report region can be created to show the output from the RESTful web services as shown in the preceding example.

Data load feature (SQL Workshop/utilities/data load)

The data load feature enables us to load or unload data from our Oracle Database Cloud Service. The utility enables you to upload data from a text file, an XML document, or a spreadsheet. This utility is accessed from the Application Express SQL Workshop.