Sei sulla pagina 1di 45

Oracle Application Express (APEX)

Contact Information

Akash
akash@focusthread.com

1
Oracle Application Express Course Overview

• This course introduces the candidates to Oracle Application Express.


• It is designed to give candidates practical experience in using this tool for
building user applications for the Web

2
Skills Gained

• The candidates will practice:


– Developing a Web Application
– Creating Reports
– Creating Forms
– Managing Pages and Regions
– Using and Managing Shared Components in an Application
– Adding Page Processing Components
– Managing Database Objects
– Building Queries of Database Objects
– Deploying an Application as a Packaged Application
– Managing Users and Groups
– Authorising and Authenticating Users
– Administering APEX Workspaces
– Loading and Unloading Data or Application Components
– Deploying an Application

3
Course Objectives

• By the end of the course, candidates will be able to use the Oracle Application
Express development environment for functional application development for
the Web.
• They will gain practical experience in building and deploying applications for
the Web, in using Application Express to manage database objects and in
administering the Oracle Application Express environment.

4
Prerequisites for this course

• A working knowledge of SQL and PL/SQL is required.


• Some knowledge of HTML would be beneficial but is not essential.
• Some knowledge of JavaScript would be beneficial but the same is also not
essential.

5
Course Contents - DAY 1

• Session 1: Introduction to Oracle Application Express


– APEX Concepts
– APEX Main Components
– Create a Workspace
– Workspace Administrator
– Log into APEX
– Run an Application

• Session 2: SQL Workshop


– Browse Objects, Create Objects and Modify Objects
– Process Ad Hoc SQL Statements
– Manage Scripts and data
– Create, Run and Save SQL Queries.

6
Course Contents - DAY 1 (cont…)

• Session 3: Build An Application


– Application Components
– Create an Application
– Create an Application from a Spreadsheet
– Create Reports Using Wizards
– Edit Report Attributes
– Add Links to Reports
– Save Reports in Different Formats
– Print Reports in Different Format

• Session 4: Pages and Regions


– View Page Definitions
– Edit Page Definitions
– Create a New Region
– View Region Attributes
– Add Comments
– Add a Title
– Add a logo

7
Course Contents - DAY 1 (cont…)

• Session 5: Hands On
– Create a Workspace
– Explore SQL Workshop, Browse, Create & Modify objects
– Create an Application, Reports, Pages and Regions.

8
Session 1: APEX Concepts

• Oracle Application Express (Oracle APEX), formerly called HTML DB, is a rapid web application development (RAD)
tool for the Oracle database.
• Using only a web browser and limited programming experience, you can develop and deploy professional
applications that are both fast and secure.
• Oracle application express combines the qualities of a personal database, productivity, ease of use, and flexibility
with the qualities of an enterprise database, security, integrity, scalability, availability and built for the web.
• Application Express is a tool to build web-based applications and the application development environment is also
conveniently web-based.

9
Session 1: APEX History

• APEX has been around for quite some time perhaps even longer than most people know. The first public release of
APEX, or HTML DB as it was called then, came in 2004, but its history reaches back quite a long way.

• Various releases have been introduced; each providing improved features and functionality. The following is a very
brief list of the releases and some of the more notable features:

– HTMLDB 1.6 (2004) introduced themes, master-detail forms, page groups, page locking, and some multilingual
capabilities.
– HTMLDB 2.0 (2005) introduced SQL Workshop, graphical query builder, database object browser, and session state
protection.
– APEX 2.2 (2006) introduced packaged applications, the APEX dictionary views, and the access control wizard.
– APEX 3.0 (2007) introduced PDF printing with BI Publisher, migration from Microsoft Access, and page and region
caching.
– APEX 3.1 (2008) introduced Interactive Reports, runtime-only installation capability, and improved security.
– APEX 3.2 (2009) introduced a migration helper for Oracle Forms based systems and various security enhancements.

10
Session 1: Application Express Usages

• Application Express is a productive tool to build applications that report on database data.
• Reports are typically hyper text linked with other reports allowing users to navigate through database data in the
same way they navigate web sites.
• Columns in reports can be easily linked to other reports, charts, and data entry forms and it is all done declaratively.
An extensive charting engine allows SQL queries to be represented graphically and that allows data to be more
effectively communicated.
• Application Express is also very adept at editing database data and supports a large number of declarative form
controls including radio groups, checkboxes, select lists, shuttles, text editors, and date pickers.

11
Session 1: Apex 4.0 and the Future

• The entire focus of APEX 4 was to make development of rich interactive Web 2.0 applications easier by making the
process as declarative as possible. APEX 4 has introduced so many new features—indeed, new ways to attack
problems—that it will be hard not to choose APEX as the preferred development platform for Oracle-based
applications.
• APEX 4.0’s Dynamic Actions provide a way for you to define client side behaviors, such as enabling or disabling
fields or regions declaratively without JavaScript. With some JavaScript knowledge under your belt, you can create
complex dynamic actions that do client side calculations, AJAX, and more.
• An improved Charting Engine based on AnyChart 5.1 provides declarative Flash-based charts, gauges, maps, and
Gantt charts. All chart types are interactive and drillable, and several charts can be combined into a dashboard style
interface.
• Probably the most exciting new feature is the new plug-in architecture that provides an extensible framework allowing
APEX Community members to build and share their own custom item, region, process, and dynamic action types.
• While APEX 4 is definitely a giant leap forward from the architecture of APEX 3, the plug-in architecture blows the
doors wide open to change from the broad and growing community of APEX developers.
• APEX now comes with a Team Development feature that eases the management of the development process by
tracking features, to-do lists, bugs, and milestones. A user feedback mechanism is also included that allows users to
provide inline feedback while using the system.
• Websheets provide a fast and direct way for end users to gather and share information without IT intervention. Armed
with only a web browser and access to the Websheets application, end users can define page content, data grids,
and reports and decide who else in the enterprise has access to that data.

12
Session 1: Architecture

• Application Express lives completely within your Oracle database. It is comprised of nothing more than data in
tables and large amounts of PL/SQL code. The essence of Oracle Application Express is approximately 215 tables
and 200 PL/SQL objects containing 300,000+ lines of code.
• The browser sends a URL request that is translated into the appropriate Oracle Application Express PL/SQL call.
• After the database processes the PL/SQL, the results are relayed back to your browser as HTML. This cycle
happens each time you request or submit a page.
• The application session state is managed in the database tables within Application Express. It does not use a
dedicated database connection. Instead, each request is made through a new database session, consuming
minimal CPU resources.

• Versions before to Oracle Database 11.1 require


Oracle HTTP Server (Apache) with mod_plsql.
The following illustration shows that architecture.

• With Oracle Database 11.1 or higher or Oracle


Database 10g Express Edition, you can remove Oracle
HTTP Server (Apache) from the architecture and
replace it with the embedded PL/SQL gateway.

13
Session 1: Main Components

• No client software is required to develop, deploy, or run Application Express applications.


• Application Express provides three primary tools:
– Application Builder - to create dynamic database driven web applications
– SQL Workshop - to browse your database objects, run ad-hoc SQL queries, as well as a graphical query
builder
– Team Development - Use Team Development to track new features, non-feature to do tasks, bugs, and
milestones. Users can also provide real-time feedback which then can be categorized into features, to do
tasks, or bugs.
– Administration - links to the Workspace Administration page.

14
Session 1: Workspace

• Oracle Application Express enables a single Oracle database to become a shared workgroup database service.
Multiple users can access it using a Web browser without installing additional software.
• Workspaces: The area where you develop applications is called a workspace. A workspace is a virtual private
database that enables multiple users to work within the same Oracle Application Express installation while keeping
their objects, data, and applications private.

15
Session 1: Workspace

• When setting up Application Express users at a large organization, you assign roles and privileges to specific users.
The roles within Application Express include the following:
• Workspace administrators are users who perform administrator tasks specific to a workspace such as managing
user accounts, monitoring workspace activity, and viewing log files. For this guide, you will be acting as the
workspace administrator when setting up the development environment.
• Developers are users who create and edit applications. Developers can have their own workspace or share a
workspace.
• End users have no development privileges. You define
end users so that they can access applications that do
not use an external authentication scheme.
• Oracle Application Express administrators are
superusers that manage an entire hosted instance
using the Application Express Administration Services
application.

16
Session 1: Create a Workspace

• A workspace is a shared work area within the Oracle Application Express development environment that has a
unique ID and name. All users in the workspace can access all its applications and scripts.
• Log in to Oracle Application Express Home page and click Apex (http://127.0.0.1:8080/apex/f?p=4950:1)

• Login as SYS user and enter the details as shown

17
Session 1: Login to Apex

• To log in to your local instance of Application Express, you must have this information:
• URL where you can access Application Express
• Workspace name you use to develop applications
• Username set up for you for this workspace within Application Express
• Password set up for you for this workspace within Application Express

• You might want to create user accounts for other developers who will be sharing this workspace. Associating users
with the workspace grants them access to all applications and scripts within that workspace. You can also create
additional user accounts for workspace administrators.

18
Session 1: Run an Application

• To run a demo application from the Application Builder home page:


• Log in to the Workspace home page.
• Click the Application Builder icon.
• Click the application to be run.
• The Application home page appears.
• Click the Run Application icon.
• Enter the appropriate login credentials and click Login.
– For Sample Application:
• For User Name, enter either demo or admin.
• For Password, enter the current workspace name in lowercase letters.
– For other demonstration applications, enter your workspace user name and password.

19
Session 1: Run an Application

20
Session 2: SQL Workshop

• SQL Workshop. Use the SQL Workshop to access tools to view and manage database objects. Click SQL
Workshop to access the following database tools:
– Object Browser. View, create, modify, browse, and drop database objects. Use the PL/SQL editor to edit and
compile packages, procedures, functions, and triggers while taking advantage of error reporting.
– SQL Commands. Run SQL commands and anonymous PL/SQL, scripts, and saved queries.
– SQL Scripts. Create, edit, view, run, and delete script files. You can also upload and download scripts from
your local file system.
– Query Builder. Search and filter database objects, select objects and columns, create relationships between
objects, view formatted query results, and save queries with little or no SQL knowledge, using Query Builder's
graphical user interface
– Utilities. Load and unload data from an Oracle database, generate DDL, view object reports, manage User
Interface Defaults, restore dropped database objects, compare schemas, monitor the database, and view
database details.

21
Session 2: SQL Workshop – Object Browser

• The Object Browser page is divided into two sections:


• Object Selection pane displays on the left side of the Object Browser page and lists database objects of a selected
type within the current schema. You can further narrow the results by filtering on the object name.
• Detail pane displays to the right of the page and displays detailed information about the selected object. To view
object details, select an object in the Object Selection pane. Click the tabs at the top of the Detail pane to view
additional details about the current object. To edit an object, click the appropriate button.

22
Session 2: SQL Workshop - Object Browser

• The Query Builder page is divided into three sections:


• Object Selection pane displays on the left side of the page and contains a list objects from which you can build
queries. Only objects in the current schema display.
• Design pane displays to the right of the Object Selection pane and above the Conditions, SQL, Results, and Saved
SQL tabs. When you select an object from the Object Selection pane, it appears in the Design pane.
• Output pane displays below the Design pane. Once you select objects and columns, you can create conditions, view
the generated SQL, or view query results.

23
Session 2: SQL Workshop – SQL Command

• The SQL Command Interface allows you to interact with the underlying schema(s) using standard SQL commands
or PL/SQL as you would in any other GUI tool or SQL*Plus. The difference is that you can save the statements for
use at a later time. Figure below shows a simple SQL statement as executed in the SQL Command Interface.

24
Session 2: SQL Workshop – SQL Scripts

• A SQL script is a set of SQL commands saved as a file in SQL Scripts. A SQL script can contain one or more SQL
statements or PL/SQL blocks. You can use SQL Scripts to create, edit, view, run, and delete script files.
• Notes while using SQL Commands
– SQL*Plus commands in a SQL script are ignored at run time.
– There is no interaction between SQL Commands and SQL Scripts.
– You can cut and paste a SQL command from the SQL Script editor to run it in SQL Commands.
– SQL Scripts does not support bind variables.

25
Session 2: SQL Workshop – SQL Scripts

• A SQL script is a set of SQL commands saved as a file in SQL Scripts. A SQL script can contain one or more SQL
statements or PL/SQL blocks. You can use SQL Scripts to create, edit, view, run, and delete script files.
• Notes while using SQL Commands
– SQL*Plus commands in a SQL script are ignored at run time.
– There is no interaction between SQL Commands and SQL Scripts.
– You can cut and paste a SQL command from the SQL Script editor to run it in SQL Commands.
– SQL Scripts does not support bind variables.

26
Session 2: SQL Workshop – Query Builder

• The Query Builder is a utility that allows you to build SQL Select statements using a more graphical interface. While
it’s not quite drag and drop, it is fairly intuitive. When you first enter the Query Builder, you’re presented with a screen
that lists all of the tables and views that are available in the currently active schema.

27
Session 2: SQL Workshop – Query Builder

• While the query builder is very useful and allows you to put together a basic query fairly quickly using a simple GUI, it
does have its limitations. As a final note, it’s worth mentioning that the Query Builder is linked to from several places
within APEX, so any time you’re prompted for a SQL statement (for example, as the basis for a report) you will be
able to open the Query Builder in a pop-up window and return the query to the calling form.

28
Session 2: SQL Workshop – Utilities

• The SQL Workshop Utilities section gives you access to tools and reports that help you view and manage information
about the underlying database objects and their data. In this section, I’ll introduce each tool set and its main purpose.
However, the majority of these tools are very straightforward, so in most cases I’ll leave the deep details for you to
explore on your own.
• The Utilities home page presents you with a quick icon based menu to each of the individual utility areas. Clicking on
any one of these icons takes you directly to the tools page for that category.

29
Session 3: Build An Application

• An application is a collection of database-driven Web pages linked together using tabs, buttons, or hypertext links.
• The pages within an application share a common session state definition and authentication method.
• Application Builder is the tool you use to build the pages that comprise an application.

30
Session 3: Build An Application

• Components of an Application:

– Run Application submits the pages in the current application to the Application Express engine to render
viewable HTML.
– Supporting Objects links to the Supporting Objects page.
– Shared Components links to a list of shared components and user interface controls that can display or be
applied on every page within an application.
– Utilities various utilities for the application context
– Export/Import links you to the Export/Import Wizard. Use this wizard to import and export an entire application
as well as related files such as cascading style sheets, images, static files, script files, themes, user interface
defaults, and workspace users.

31
Session 3: Build An Application

• 2 Ways to Create an Application:


– Database
• The application is based on
SQL queries or database tables.
– Spreadsheet
• The application is based on
Spreadsheet.

32
Session 3: Build An Application

• Create Reports using Wizard


– Creates a report without requiring any
SQL knowledge. Select the appropriate
schema, table, columns, and result set
display.
– Select Wizard, select the title of the
Report.
– Select the Table.
– Select the Column
– Select the Template
– Create the Region

33
Session 3: Build An Application

• The Report Attributes page appears and is divided into the following sections:

– Column Attributes control the report layout.

– Layout and Pagination attributes control report pagination.

– Sorting attributes enable you to define images and image attributes for images that display in report headings
to sort values.

– Messages contain attributes that enable you to define messages that display if no data is found or more data is
found than can be displayed.

– Report Export attributes enable you to add download link to a report or export a report as either an XML file or
CSV file.

– Break Formatting attributes enable you to control if a specific column repeats and how column breaks appear
when printed.

34
Session 3: Build An Application

• Creating a Link to another page:


– Navigate to the appropriate Report Attributes.
– Under Column Attributes, locate the column to contain the link.
– Click the Edit icon next to the column name.
– The Column Attributes page appears.
– Scroll down to Column Link.
– To create a column link to another page:
• From Target, select Page in this Application.
• (Optional) In Link Attributes, specify additional column link
attributes that will be included in the <a href= > tag
• In Link Text, enter the text to be displayed as a link, specify an image tag,
or pick from the list of default images.
• In Page, specify the target page number. To reset the pagination for this page, select Reset Pagination.
• In Request, specify the request to be used.
• In Clear Cache, specify the pages (that is, the page numbers) on which to clear cache. You can specify
multiple pages by listing the page numbers in a comma-delimited list.
• Use the Name and Value fields to specify session state for a specific item.
– Click Apply Changes.

35
Session 3: Build An Application

• Saving Reports using Interactive Report Regions with Apex 3.1


• Click the Actions Menu icon and select Save Report .

• Enter a name for the report and click Apply

• A tab with the name of your report was created and the details (filters, control breaks, sorts, etc.) have been saved.
You can also view the working report. Click Working Report.

• The working report is now displayed. You can make any changes
to this report and it will not be reflected in the saved report

36
Session 3: Build An Application

• Printing Reports using Interactive Report Regions with Apex 3.1


• Click the Actions Menu icon and select Download .

• This action is used to download the current result set. The download formats will differ depending upon your
installation and report definition but may include CSV, XLS, PDF, or RTF. Perform the following steps
• Select a format to download, in this case CSV.

• A CSV file was created with all the data.

37
Session 4: Pages and Regions

• A Page Definition is the basic building block of a page.

• Each page can have buttons and fields (called items), which are grouped into containers called regions.

• Pages can also have application logic (or processes).

• You can branch from one page to the next using conditional navigation; perform calculations (called computations);
perform validations (such as edit checks); and display reports, calendars, and charts.

• You view, create, and edit the controls that define a page by accessing the Page Definition.

• To access the Page Definition for an existing page:


– On the Workspace home page, click the Application Builder icon.
– The Application Builder home page appears.
– Select an application.
– The Application home page appears.
– Select a page.
– The Page Definition appears.

38
Session 4: Pages and Regions

Session 4: Pages and Regions

39
Session 4: Pages and Regions

• A page is the basic building block of an application.


• Each page has a page number, a name, and typically some text attributes such as a header, title, and footer.
• You add content to your page by creating page controls (regions, items, and buttons).
• Page templates and page region templates control the exact look and feel of each page.
• Each Page Definition is divided into three sections:

– Page Rendering, is the process of generating a page from the database. Use the Page Rendering section to
modify controls that impact the rendering of a page, including page attributes, regions, buttons, items, page
rendering computations, and page processes.

– Page Processing is the process of submitting a page. A page is typically submitted when a user clicks a
button. Use the Page Processing section of the Page Definition to specify application logic such as
computations, validations, processes, and branches. In general, the Application Express engine runs this logic
in the order it appears on the Page Definition.

– Shared Components section of the Page Definition contains common elements that can display or be applied
on any page within an application.

40
Session 4: Pages and Regions

• Create a new region:


– Click create on the Region.
– Choose the type of the region
– Add title and click Create Region
• Editing Report Attributes
– Access the Report Attributes page by clicking the Report link next to the report region you want to edit on the
Page Definition.
– You can also navigate to the Report Attributes page by clicking the region name and then selecting the Report
Attributes tab

41
Session 4: Pages and Regions

• Creating an Application Comment


– Navigate to the Workspace home page.
– Click the Application Builder icon.
– Select an application.
– On the Application home page, click Shared Components.
– The Shared Components page appears.
– Under Application, click Application Comments.
– The Application Comments page appears.
– Enter comments in the Comments field and click Apply Changes.

42
Session 4: Pages and Regions

• Logo
• Use Logo attributes to define an application logo.
• An application logo can be text-based or image-based.
• To use this feature, your page template must include the #LOGO#substitution string.
• To define an application logo:
• For Logo Type, select one of the following:
– Select Image to use an image for the application logo.
– Select Text to use text for the application logo.
• In Logo, enter the following:
– For an image, enter the complete image name, including the
filename extension. For example: /i/mylogo.gif
– For text, enter the full text string. For example:
– Sample Application
• In Logo Attributes, enter the appropriate attributes for the logo.
• Image example:
• width="100" height="20" alt="Company Logo" Text example:
• style="font-family:Arial; color:#000000; font-size:18; white-space:nowrap; font-weight:bold;"

43
Session 5: Hands On

– Exercise 1: Create/Request for a Workspace

– Exercise 2: Explore SQL Workshop, Browse, Create & Modify objects

– Exercise 3: Create an Application, Reports, Pages and Regions.

44
Questions?

Contact Information

Akash
akash@focusthread.com

45

Potrebbero piacerti anche