Feed aggregator

Reverse engineer existing Oracle tables to Quick SQL

Dimitri Gielis Blog - Fri, 12/08/2017 - 20:01
If you didn't hear about Oracle Quick SQL, it's time to read about it as it's something you have without knowing (it's a packaged app in Oracle APEX) and I believe you should start using :)

Quick SQL enables you to rapidly design and prototype data models using a markdown-like shorthand syntax that expands to standards-based Oracle SQL. You can easily create master detail relationships, check constraints, and even generate sample data.
In my blog post Create the Oracle database objects I go over the history how I created database objects and why I think Quick SQL is great and why I use it.

I guess most people typically use Quick SQL at the start of a new project, as it's the quickest way to create your data model and Oracle database objects. That is my primary use case too, but I started to use Quick SQL even on projects where database objects already exist.

In the project I'm currently involved in, the datamodel was generated by another tool, but as we iterate through the project, tables change, columns get renamed and added, row version were requested, triggers need to be made Oracle APEX aware...

Now we could do those changes manually, but I thought it made much more sense to create the data model in Quick SQL and use the features that come with Quick SQL. By clicking a checkbox we can include a Row version, Quick SQL generates the triggers automatically in an APEX aware form, we can generate as much sample data as we want by adding /insert and we can use all the other features that come with Quick SQL. For example when you want to include a history table in the future it's just another checkbox to click.


It's also easy to check-in the Quick SQL script into source control, together with the generated DDL.
If changes need to be done, we can adapt in Quick SQL and generate the DDL again and we see the changes immediately. It would be nice if Quick SQL could generate the ALTER statements too, but that's not the case yet. But it's easy enough to see the changes that were done by comparing the scripts in source control.

If you also want to reverse engineer an existing model into Quick SQL, here's a script that gives you a head start generating the markdown style format.


I tried the script on the Quick SQL data model itself - the result you see below:


Hopefully you see the benefit of using Quick SQL in existing projects too and the script helps you get there. Also Quick SQL gets frequent updates - in the upcoming release (17.3.4), which is already online, you can add a Security Group ID to every table (to make your app multi-tenant) and you can rename the audit columns to your own naming conventions.

Great Britain and Northern Ireland February 2018 Dates: “Oracle Indexing Internals and Best Practices” Seminar (Battle For Britain)

Richard Foote's Blog - Fri, 11/17/2017 - 06:25
UPDATE: ALL TICKETS ARE NOW AVAILABLE FOR PURCHASE !! Attention Oracle Professionals in the United Kingdom !! I have now finalised all the dates and venues for a series of my popular and critically acclaimed “Oracle Indexing Internals and Best Practices” seminar I’ll be running in the UK in February 2018. I’m extremely excited as […]

Meet me in Australia and New Zealand at the OTN Days 2017

Dimitri Gielis Blog - Tue, 11/14/2017 - 15:07
Tonight I'll start my trip from Belgium to Australia and New Zealand. Although we have a company in New Zealand and Australia, which Lino is managing, I've never been there myself. It has always been my dream to visit the other side of the earth, so I look forward to it :)

I'll present on how I build Oracle APEX apps today (and in the future) and how to make them available for others (cloud and others).

My schedule of the OTN Days 2017 (APAC Tour) looks like this:
If you are in one of those places, I would love to meet you and hear how you use Oracle APEX.
And I'm always up for showing you a live demo of APEX Office Print, you'll see our upcoming AOP 3.2 version as first! Just grab me by my arm and ask :)

In Perth there will also be a Q&A slot - so any Oracle APEX question can be asked there.

APEX Office Print 3.1 released - support for Docker

Dimitri Gielis Blog - Mon, 10/16/2017 - 12:46
Last week we release APEX Office Print (AOP) 3.1, our best release ever :)

AOP was already the easiest and most fully integrated printing and exporting solution for Oracle APEX, but with every new release we allow you to customise the way you use AOP a bit more and add more advanced functionalities.

As more and more bigger companies are using AOP, we focussed in this release more on enterprise features, for example, native HTTPS support, end-to-end and customisable debugging, a new queuing system for large amounts of prints and overall performance enhancements and general improvements.
You can read more about this release in our release history.

One other addition I want to highlight is the ability to run AOP in a Docker configuration.
The Docker image is available for our Gold and Enterprise license.

Docker is the world’s leading software container platform. If this concept is new for you, you can read more at What is Docker?



In the previous days Martin Giffy D'Souza blogged about How to Setup Oracle DB 12.2 Docker Container and Docker Oracle and APEX and Roel Hartman talked about Dockerize your APEX development environment. Those are some excellent posts how to get started with Docker in an Oracle Database and APEX context.

The most important reason for us to make an APEX Office Print docker image available was to ease the installation of multiple AOP instances even more and give the possibility to scale AOP in an enterprise way.

Here's a video how you are up and running with our AOP docker image in less than a minute:



You also find the detailed steps in the AOP documentation.

Juergen Schuster and Martin Giffy D'Souza did a podcast with me end of August, where I talk a bit about AOP and our development too.

If you are not yet on APEX Office Print 3.1, go and download the latest version, even when you are not enterprise, it's worthwhile the upgrade. We updated our AOP Sample Application with some new examples too.


Happy printing and exporting from Oracle APEX with AOP :)

Talking about APEX Reporting and AOP @ Montreal Oracle Dev Day 2017

Dimitri Gielis Blog - Wed, 10/11/2017 - 06:00
For those in Montreal and the surrounding area I encourage you to come out to the Montreal Oracle Dev Day on October 25th (8:30-4:30 at Centre for Sustainable Development).

Here’s a summary agenda of the presentations with the full agenda here:
Aside from the presentations you will have plenty of opportunity to network and share your Oracle development experiences. All speakers will be available all day so feel free to bring your APEX questions!

You can register now online.

As I'm not that much in this part of the world it would be great to meet in person. I would love to hear your thoughts on APEX Office Print (AOP) too.  If you have any questions, feedback or just want to talk how to use AOP in your environment, don't hesitate to come up to me. I'm more than happy to talk to you :)

JavaScript, Node.js, JET and APEX day, 7-NOV-2017, Belgium

Dimitri Gielis Blog - Mon, 10/09/2017 - 09:07
With great pleasure I can announce we have a special APEX Meetup in Belgium on Tuesday, November 7, 2017.

Dan McGhan is our special guest and will present on different technologies that will enrich your life as an Oracle APEX Developer too.

Unlike our other APEX Meetups, we decided to do a full day event, with food and drinks :) The event is sponsored by APEX R&D, iAdvise, ODTUG and Oracle.

Agenda:• 8.30 am - 9 am: welcome coffee and registration• 9 am - 10 am: Setup help for those that couldn't do it before (VM with Oracle & Node.js - optional)• 10 am -11 am: Intro to JavaScript for PL/SQL and APEX Developers (language mechanics and DOM basics)• 11 am -12 pm: Intermediate JavaScript for PL/SQL and APEX Developers (Ajax, promises, etc.)• 12 pm - 1 pm: Lunch• 1 pm - 2 pm: Intro to Node.js• 2 pm - 3 pm: RESTful APIs with Node.js• Coffee Break• 3.30 pm - 4.30 pm: Intro to Oracle JET• 4.30 pm - 5.30 pm: Using JET and Node.js with APEX• Closing Drink

We have a capacity of 75 people, so if you didn't register yet, you find the link here.

Choosing the right template and print to PDF from your Oracle APEX application

Dimitri Gielis Blog - Fri, 10/06/2017 - 12:19
This post is part of a series of posts: From idea to app or how I do an Oracle APEX project anno 2017

To motivate players to exercise more, I thought it would be a good idea to give the players a diploma (certificate) when they complete the multiplication table. They will be able to download or print this certificate if they have a specific score. I designed it that we have one official diploma of mtable.online, but there's also the ability so teachers or people at home can print their own certificate in the template or colours they want.

Creating the diploma

Creating a certificate in Microsoft Office is not that hard, in fact online you find many certificate templates you can just download. Mostly are in Word or Powerpoint format.



In our multiplication table project we have the concept of teams. One or more players can be part of one or more teams. A team could be for example a classroom and the students are the players within that team. I want the team manager be able to upload a template for the certificate (diploma) of the team.

How integrating those certificates in Oracle Application Express (APEX)?

With APEX Office Print, this becomes very easy!


APEX Office Print (AOP) is a print server for Oracle Application Express (APEX) which allows you to define your template in Word, Excel, Powerpoint, HTML or Markdown and merges it with your data in the Oracle database. As output you can select PDF, Word, Excel, Powerpoint, HTML or Markdown. APEX Office Print comes with an APEX Plug-in and PL/SQL API that makes it very easy to select the template and the data in any Oracle APEX application. AOP is also smart and understands Oracle APEX meta-data, so for example printing one or more Interactive Reports or Grids to Excel or PDF is done in a breeze. Till date, APEX Office Print (AOP) is the most integrated, easiest and flexible printing and data exporting solution for Oracle Application Express (APEX).
Full disclosure, my company APEX R&D is the maker of AOP, so I might be a bit biased, but you can check this youtube video where different APEX printing solutions are discussed.

Installation of the AOP plugin

When you go to the APEX Office Print website, you can download the cloud or on-premise version and try it out for 100 days. You just have to click sign up, provide an email go to Downloads and click the Cloud package.


 Extract the zip file that was downloaded and locate the db folder and plugin folder.



Import the APEX Plug-in by going into your APEX app, to Shared Components, Plug-ins, hit the import button and choose the dynamic_action_plugin_be_apexrnd_aop_da_51.sql file. Depending the version of APEX, you might need to choose the _50.sql file (in case of APEX 5.0). Follow the wizard to import the plug-in.



The plug-in calls a package, so there's one more step to do in order to make the plug-in work. Go to SQL Workshop > SQL Scripts and hit the Upload button and select the file aop_db_pkg.sql from the db folder.



Next, click on the Run button to run the script, which will install the AOP_API3_PKG PL/SQL package.

That's it - you successfully installed the AOP plug-in and are now ready to use it in your application.

Note: in the above example we installed the Dynamic Action plug-in. AOP also comes with a process type plugin, in case you prefer a process over a dynamic action.


Calling the AOP plugin from your page

Create a new dynamic action, for example Click on a button and as Action select the APEX Office Print (AOP) Plug-in:



The plug-in is very flexible and has many options, yet it's so easy to use. You first tell the plugin where your template is; in Static Application Files (Shared Components), in a table (define your SQL), a url, the filesystem, ... you just select where and tell it which one.

Next you have to tell which data you want to use, you can define SQL, PL/SQL, URL or even the static id of the region. AOP is so smart it will understand if you put the static id of an Interactive Report or Grid, a Classic Report or even a JET or other chart. Behind the scenes AOP is reading the meta-data, so it will use whatever is behind that region as source. This is one of the most liked features by our customers and something no other printing solution offers.



The plug-in has build-in help and examples, so it's more easy to know how to use the plugin.

You can define some other settings (which items to submit in session state, some special report settings etc.) and finally the output you want; PDF, Word, Excel, you name it.

Print the diploma

When you go to mtable.online, you can view the highscores for all players, or the highscores within a team.



Based on some rules you might be able to print a diploma. The logic which defines if you are allowed to get a diploma I wrapped in a view:


Now the interesting thing is that we can define the selection of the template dynamically in the AOP plugin. So I've some PL/SQL code that returns the correct template. If a team is selected, we will use that template of the team, if it doesn't have one, or if you are looking at all players, we will use the default template defined by us. As described in the first paragraph, the owner of the team can define his own template, they don't need to contact us (the developers) anymore. The just create their template in Word, Excel or Powerpoint and upload it.

From the very start when developing AOP, this was a main goal; we want the business users be able to create their own template. As a developer we just provide them the data, how it looks like the business people can define. With other printing solutions, I had to spent hours and hours redefining the template in XSL-FO, iReport, or other tools, but with AOP, as a developer my job is done, the moment I write my query :)

Back to the diploma in mtable.online; as default the template I used was a Powerpoint I downloaded from the certificate templates site. The only thing I changed was adding the substitution variables that AOP would understand: {player_name}, {mi_ss}, {play_date} (those are the columns in my query - see further)


 For my team, I went with a Word Template:


 And my plug-in looks like this:


Whenever the diploma link is clicked in the report, the AOP Dynamic Actions kicks in and generates the PDF, based on the template from the team (Word) or the default (Powerpoint). That's it :)

APEX Office Print is even more used in the Multiplication Table project; namely when you go to the  details of an exercise, which are shown in an Interactive Grid, AOP exports this Interactive Grid to our own Excel template. I'll do a dedicated post on that as there're more interesting steps to talk about with adding buttons and custom dynamic actions to an Interactive Grid.

If you didn't try APEX Office Print 3.0 yet, you can sign up for a trial for free. In a few days we ar also releasing AOP 3.1, our best version ever :)

Indexing Seminar: Why Small Classes? (A Small Plot Of Land)

Richard Foote's Blog - Wed, 10/04/2017 - 21:50
Firstly, a huge thank-you to everyone who has enroled in one of my “Indexing Internals and Best Practices” Seminars running soon is Australia. The feedback and overall reaction has been extremely positive and I can’t wait to present all the material I’ve been putting together these past few weeks. There are currently limited places still […]

Oracle Indexing Myths (Telling Lies)

Richard Foote's Blog - Mon, 09/25/2017 - 21:41
I’m currently hard at work fully revising and updating my “Indexing Internals and Best Practices” seminar in time for a series of events I’ll be running in Australia in October/November. This has been a highly popular and acclaimed 2 day seminar that is a must for any DBA, Developer, Solutions Architect or anyone else interested […]

Multiple APEX Workspaces in one Oracle Exadata Express Cloud account now possible

Dimitri Gielis Blog - Sat, 09/23/2017 - 10:50
Last night my Oracle Exadata Express Cloud account was updated to APEX 5.1.2, but there was more updated once I looked closer into the dashboard.


Before we could already create multiple Oracle schemas, but from now on within one Oracle Exadata Express account you can create multiple APEX Workspaces.

Go to Instance Administration under the Application Express setting in Manage:


Clicking on Manage Workspaces > Create Workspace


Just follow the wizard; you can attach the workspace to an Oracle database schema and once finished you will see.


Now when you login again in your Oracle Exadata Express account and go to the APEX App Builder it will ask you which workspace you want to login to:


The first time it will give you a welcome message and asks to set a password


As it's an Oracle cloud account with identity management, I don't really need to set a password, I just need to confirm my profile


That's it! You are now in your new Oracle Application Express (APEX) Workspace.

It's very nice to see Oracle Exadata Express getting better with every maintenance release. Thanks Oracle :)

Update 23-SEP-2017: another new feature is that you can export your Oracle schemas and data to the Oracle Storage Cloud Service.

Go to Export to Cloud Storage:


Add your Oracle Cloud storage details and select the schemas to be exported:


“Oracle Indexing Internals & Best Practices” Seminar: Australia 2017 Tour (Stage)

Richard Foote's Blog - Mon, 09/18/2017 - 22:10
I’ll be running a fully revised and updated version of my acclaimed “Oracle Indexing Internals and Best Practices” seminar throughout Australia in Oct/Nov 2017. Previous versions of this seminar have been hugely popular and run in some 18 countries. This updated version will feature lots of new material including 12c related indexing capabilities and recommendations. […]

Richard Foote Consulting Has Arrived (New Angels Of Promise)

Richard Foote's Blog - Sun, 09/17/2017 - 22:32
Today is the official launch of Richard Foote Consulting, my new independent company in which I’ll be providing specialist Oracle Database consulting and training services, focusing on database performance tuning, database problem resolutions and database health check assessments (at least until everyone moves across to the new self-tuning Oracle Cloud database). Based on all the […]

From idea to app or how I do an Oracle APEX project anno 2017

Dimitri Gielis Blog - Wed, 09/06/2017 - 19:00
For a long time I had in mind to write in great detail how I do an Oracle APEX project from A to Z. But so far I never took the time to actually do it, until today :)

So here's the idea; I love building projects that help people and I love to share what I know, so I will combine both. I will write exactly my thoughts and things I do as I'm moving along with this project, so you have full insight what's happening behind the scenes.
BackgroundWay back, in the year 1999, I build an application in Visual Basic to help children study the multiplication tables. My father was a math teacher and taught people who wanted to become primary school teachers. While doing the visits of the primary schools, he saw the problem that children had difficulties to automate the multiplications from 1 till 10, so together we thought about how we could help them. That is how the Visual Basic application was born. I don't have a working example anymore of the program, but I found some paper prints from that time, which you see here:



We are now almost 20 years later and last year my son had difficulties memorizing the multiplication tables too. I tried sitting next to him and help him out, but when things don't go as smooth as you hope... You have to stay calm and supportive, but I found it hard, especially when there are two other children crying for attention too or you had a rough day yourself... In a way I felt frustrated because I didn't know how to help further in the time I had. At some point I thought about the program I wrote way back then and decided to quickly build a web app that would allow him to train himself. And to make it more fun for him, I told him I would exercise too, so he saw it was doable :)

At KScope16 I showed this web app during Open Mic Night; it was far from fancy, but it did the job.
Here's a quick demo:



Some people recognized my story and asked if I could put the app online. I just build the app quickly for my son, so it needs some more work to make it accessible for others.
During my holidays, I decided I should really treat this project as a real one, otherwise it would never happen, so here we are, that is what I'm going to do and I'll write about it in detail :)
Idea - our requirementThe application helps children (typically between 7 and 11 years old) to automate multiplications between 1 and 10. It also helps their parents to get insight in timings and mistakes of their children's multiplications.
TimelineNo project without deadline, so I've set my go-production date to August 20th, 2017. So I've about 2 weeks, typically one sprint in our projects.
Following along and feedbackI will tweet, blog and create some videos to show my progress. You can follow along and reach me on any of those channels. If you have any questions, tips or remarks during the development, don't hesitate to add a comment. I always welcome new ideas or insights and am happy to go in more detail if something is not clear.
High level break-down of plan for the following daysSo now, let's get started ...

Adding the game, the importance of the APEX Advisor, a lot of JavaScript and adapting for mobile

Dimitri Gielis Blog - Wed, 09/06/2017 - 18:48
This post is part of a series of posts: From idea to app or how I do an Oracle APEX project anno 2017

Over a year ago I developed the game to practice the multiplications. I quickly created an Oracle APEX page, added a bunch of JavaScript and that was about it. The last weeks you could read I've redeveloped the entire app from the ground up but I still have to add the game to it.

I thought to just copy the page I developed before with all the JavaScript in the new app.

How do you copy a page from one Oracle APEX environment to another? 

Export the app from the first environment and import the app in the second environment. Once both apps are in the same workspace, you can copy a page from another app by going to the Create button:


Click the Page as Copy option and follow the wizard:



So I followed the wizard to copy the page to my new app.

Now the tricky bit was that I changed page numbers, so all my references (in JavaScript, Processes etc.) to page items were wrong. To quickly identify the issues I used the APEX Advisor.

The APEX Advisor you find in App Builder > Utilities : Advisor


The Advisor checks for best practices, errors, security issues etc. I really like the Advisor as it will give your application some kind of quality control. And it's very fast to identify issues and navigate to them. Here's a screenshot what the Advisor found:


I would always run the APEX Advisor, even when you start from a Blueprint application as you will most likely modify the app, add pages, make changes etc. and it's easy to forget for example to put an authorization scheme.

A few years ago I also wrote an extension to the APEX Advisor that would check for our own standards. You can query an Oracle APEX application with SQL, so it's easy to check if naming conventions where followed, if deployments went fine or anything else you find important. Here's a screenshot of some of the checks in one of the projects:


In the community some other people did something similar, for example Oliver Lemm wrote a Quality Assurance plugin.

So back to my application - I fixed those issues and was able to play the game :)
(screenshot from the browser)


To build the table/grid of the game I programmatically generate the APEX items by using the API apex_item.


All the rest is build in JavaScript. I'm not going to put all the source code in this blog post, but if you right click on the page where the game is, and you look at the source, you see all the JavaScript that is used.

Whenever the Start button is clicked, a Dynamic Action is fired which calls some other JavaScript functions. The fireworks and stopwatch are libraries I found on the internet which I integrated in the APEX app. If you have any question on the JavaScript side, feel free to ask in the comments section.

A few weeks ago I released the app to test. Some people sent me an email with their feedback, but many also used the build-in feedback mechanism that came with our Blueprint app.


I typically leave a feedback mechanism in every app I build (yes, even in production), it's a great way to communicate with your users.

The result of the feedback was, it didn't run great yet on mobile devices. Except from using Universal Theme, I didn't really pay attention to mobile devices, as I thought it would be too small anyway, but apparently people were trying it on there. So I decided to make sure it would work on at least a tablet, for example I saw a use case for myself to let my son play on my iPad.

In the next section I will go in a bit of detail of things that I had to adapt to make it more user friendly on a mobile device and some other things that might be interesting to know in other applications.

So here's how the app looks like on an iPad:


Compare this image with the image before taking in the browser and you will see some differences.

I added some JavaScript library to check if we run on a mobile device and when so, we add some extra CSS to make the table fit on the screen. The breadcrumb will always be shrunk and the padding is less. Here's the code:


When starting the game the keyboard comes out. One of the first things I had to do, was to make the number keyboard the default and not the normal keyboard with the letters. The way you do that is in your input text item, you define a pattern and give it a type of numeric (see the PL/SQL code where we do the call to apex_item).


The keyboard that slides out hides a part of the table, so it's not ideal. I've an external keyboard for my iPad, so hooking that up, makes it a really nice experience:


Another issue on the iDevice was that the fireworks at the end of the game didn't work well. So I decided to add a setting, so you can choose what you want to see at the end when you finish the game and when you run on an iDevice, the Fireworks is hidden.


The other settings are based on feedback. Some people don't want to play all numbers yet, so you can now pick the numbers. Some others wanted to see the time or countdown, and for some others they got stressed by it. So I decided to make it customizable per player.

Those preferences are all normal APEX items, but the difference is the way they get stored. I only use one field (preferences column in the mtl_player table) to store all preferences. The way I do that was inspired by the APEX Multi-language translate plugin (JTL Item) from my friend Jorge Rimblas, who stored all translations in one field by using JSON. So, all the settings of the game are stored in one JSON object.


On page load I use following JavaScript to set the items:


There's also a save button in the settings section. There's a straight forward dynamic action to do the update. But once saved I show a notification which is done by adding a call to the APEX JavaScript API:

apex.message.showPageSuccess("Player settings saved.")

This results in:


While you play the game on every switch of the number, the timing is saved by calling an AJAX Callback process by apex.server.process (see the source on the page when you play the game). For now I've done it this way, but maybe in the future I might cache the results and only do a callback at the end.



The last thing I want to cover is the overlay you get when you end the game. You have the fireworks, an image or a message as on the below screenshot.


The overlay is done by adding a div on the page and some CSS.



By default it has display set to none, but once the game is complete it's set by some JavaScript.


Hopefully this gives you more insight how the game was created and some things I cover are also useful in your own project.

If you want to play the game, surf to http://mtable.online.

Happy playing!

Presenting at UKOUG Tech17 Conference in December (Here Come The Warm Jets)

Richard Foote's Blog - Wed, 08/30/2017 - 00:39
I presented at the UKOUG Tech14 conference in Liverpool and thoroughly enjoyed the experience. It was one of the better User Group conferences I’ve attended and winning both the Best New Oracle Speaker and Best Oracle Speaker awards made that bit more special. So it’s with real excitement that I have the opportunity to again […]

Create a Custom Authentication and Authorization Scheme in Oracle APEX

Dimitri Gielis Blog - Tue, 08/29/2017 - 20:09
This post is part of a series of posts: From idea to app or how I do an Oracle APEX project anno 2017

Before when creating the APEX application based on a Blueprint, we used the standard APEX Authentication, which means the management of users is done in Oracle Application Express itself. As we created our own user table, we want to manage our users there and have some custom authentication scheme for our multiplication application.

In this post I will show you exactly how I built the custom authentication scheme for my Oracle APEX application you see at mtable.online.

I first decided which kind of login page I wanted. A few years ago I blogged about pimping the logging page, which is what I use on the APEX Office Print login page. This type of page is a more traditional way of building a login page in Oracle APEX. For the registration page and forgot password page we used the same techniques.


For the multiplication table project I decided to do it a bit different. I started from the landing page and build the login mechanism into that page. But also the register and forgot password are on the same page, so not like what we did for APEX Office Print, using different pages for forgot password, register and login.

Here's how my page looks like in the Oracle APEX App Builder:


There are a few regions to help with the layout (Top, Left, Right). In the Right region, there are 3 sub-regions: Login, Register, Forgot Password, which will show one at a time. Dynamic Actions (Show/Hide) control which region is seen.

From the front-end this is what it looks like.
When clicking a button an APEX process is being fired, but all the logic is defined in a package.
The package to handle the authentication I typically call [project trigram]_AUTH_PKG. It doesn't only contain the authentication logic, but also the registration, reset password and authorization logic.

The specifications looks like this:

.gist .blob-wrapper.data { max-height:600px; overflow:auto; } And the body like this:

I typically use dbms_crypto to generate (hash) the passwords, but as that package is not supported on Oracle Exadata Express at the time of writing, I use another SHA256 PL/SQL implementation.

I'm not going into too much detail on the logic in the PL/SQL package. I hope it's kinda self explanatory, but if you have any question, feel free to ask in the comments field.

Now we will focus on creating a Custom Authentication Scheme in APEX.

Go to App Builder > Shared Components > Authentication Schemes and hit the Create button to add a new one:


Enter the custom_authenticate procedure from the package we created earlier:


By default the new authentication scheme will be current, so make sure you have some data in your tables, otherwise you won't be able to login.

Next I typically add some post authentication to fill some Application Items.
Edit the Custom Authentication and add the code and post_auth as in this picture:


We have now made our application accessible to people by defining our own custom authentication scheme.

Next, we want to define which rights you have in the application. To do this, we will create two Authorization Schemes, one for a normal user and one for an administrator.

In our package we already included a function with the logic. Every user has a role defined to him, and depending the role, it's a normal user or an administrator. An administrator can do everything a normal user can do, but can also access the administrator section where we maintain our application.

Blueprint actually already created our Authorization scheme for administrators, but we will adapt it to use our package. Go to Shared Components > Authorization Schemes and modify like this:


I hope it gives you all the components to build your own custom authentication and authorization schemes.

I also recorded a video which goes in more detail on the entire process of signing up, forgetting password and logging in and the different authorization schemes and code being used.

Subscribe to Better Logic LLC aggregator