Oracle Apex Tutorial
Oracle APEX Tutorial
This tutorial gives you an overview and talks about the fundamentals of Oracle APEX.
What is Oracle Apex ?
Oracle Application Express is a free Oracle product that enables developers to quickly create web based applications on an Oracle database by using just a web browser. The APEX tool runs in a web browser and allows the creation of web applications in a declarative manner, by simply selecting pre-built components, configuring them and bundling them up in a web application, all without the need to write too much code.
APEX can be downloaded from the official Oracle website, together with documentation: http://bit.ly/8ZdMSa
Application Express (otherwise known as APEX) is a web application that is tightly coupled to an Oracle database. It has several uses: you can use its SQL Workshop tool to query the database, modify its contents, or change its structure; you can use its Application Builder tool to create your own web applications that interact with the database; and you can run the web applications created by you and others.
The application builder is especially interesting because it provides a simple, nontraditional way to build web pages. You do not specify code for the page directly; instead, you choose from a set of built-in templates. There is a template for the overall page and templates for each kind of component that you want to put on the page (such as reports, buttons, and so on). Each template has a set of properties, whose values determine where each component is located on the page, what it looks like, and how it behaves. You create a page simply by choosing templates for the components you want and assigning values to their properties.
The APEX application builder saves the property values for each component in a private database. When a browser requests one of your application’s pages, the APEX server extracts the property values relevant to that page from its database, constructs the HTML code corresponding to those values, and returns that code to the browser. This process is called rendering the page, and APEX is called an HTML generator.
The SQL Workshop
Congratulations! You are on the brink of learning how to build APEX web applications. But before you can begin, you need an APEX account. There are several ways to obtain an account: you can register for a free account through the apex.oracle.com web site; you might be given an account to an APEX server at your job; or you can even install an APEX server yourself and create your own account to it.
No matter the circumstance, your account will have an associated URL. Invoking the URL from your browser takes you to a login screen. Below Fig shows the login screen used by the apex.oracle.com server.
Entering your credentials then takes you to the APEX home screen, the top of which is shown in below Fig.
The APEX development environment contains several tools. Of primary importance is the application builder tool, which will be covered in depth starting in Oracle Apex training. We begin here by looking at two tools from the APEX SQL Workshop: the object browser, and the SQL command tool. These tools allow you to directly manipulate the database — the object browser gives you a graphical user interface, and the SQL command tool lets you submit SQL statements and PL/SQL code blocks for execution.
Although the SQL Workshop tools are not essential for application development, using them can make your life much easier. Here are five ways that they can help an application developer:
- To remind you of the database structure. For example, a typical application involves several tables, each of which can have numerous columns. It is often impractical to memorize the details of each one. When building a page that references a table, you can use these tools to help refresh your memory.
- To modify the structure of the database. For example, these tools are the easiest way to execute the alter table command given in the introduction.
- To modify the contents of the database. For example, you might want to insert or modify records to test the behavior of a page or to reset the database after testing the page.
- To examine the contents of the database. After running a page, you can verify that the database updated correctly.
- To debug an SQL statement or PL/SQL block. By executing code in the SQL command tool first, you can verify that it produces the expected result before you actually assign it as the value of some property on a page.
To get to the SQL Workshop, click the SQL Workshop button on the APEX home screen. The resulting screen is shown in below Figure. From this screen, you can then click the Object Browser or SQL Commands button to get to the desired tool.
Creating an Application
To use the application builder, you need to get to its home screen. You can either click the Application Builder tab in the APEX menu bar, or click the large Application Builder button from the APEX home screen of Figure 1-2.
The application builder’s home screen displays an icon for each application in your workspace. It is likely that your APEX account has the preinstalled application called Sample Database Application; if so, your application builder home screen looks like Fg below.
Application builder home screen
Editing Application Properties
The application builder home screen displays an icon for each application you create. Clicking an icon takes you to the home screen for that application, which displays an icon for each of the application’s pages. If you created your application as directed previously, its home screen should display an icon for the home page. If you specified a different form of authentication, you will also see an icon for a Login page.
Fig: Home screen of the newly created application
Deleting an Application
There are two ways to delete an application. At the right of the application’s home screen, there is a task labeled Delete This Application; clicking the link performs the deletion. Alternatively, on the application’s global properties screen, there is a Delete button on the left of the Apply Changes button, which appears when the Definition properties are shown.
Running an Application Page
A web application is a collection of web pages. By running a page, you are asking APEX to render it in your browser. The term running an application is shorthand for running its home page.
There are two ways to run a page:
- from within APEX (as a developer)
- from outside of APEX (as a user).
Each is considered in the following sections.
Running a Page from within APEX
The easiest way to run an application from within APEX is to click the big Run Application button on the top left of the application’s home screen, as shown in above Fig: Home screen of the newly created application.
Alternatively, you can go to the application builder’s home screen and roll the cursor over the icon for the application; the icon will change to display two smaller buttons as shown in below Fig. Clicking the arrow button runs that application