Sunday, July 29, 2007

Oracle APEX: onload in Page HTML Body Attribute

Did you already try to put an onload javascript event in the HTML body of your page in APEX?

You may want to do that to run some initial javascript when your page loads.
For ex. in DG Tournament I use the onload event to enable Google Suggest.

In Oracle Application Express you put the onload event in the HTML Body Attribute section


If you would look in the source of your HTML page you would see something like:
<body onload="get_ApexEvangelists();">

However, when you try to put the above code as HTML Body Attribute, you may get the error "You may not declaratively set cursor focus if you specify an ONLOAD in this attribute."
The complete message:
You should always read the messages ;-) But I noticed (also with myself) that you check quickly your code to see what you did wrong. However it has nothing to do with your code...

You can fix this error by go to the Display Attributes of your Page and set the Cursor Focus to "Do not focus cursor" instead of that APEX puts the focus to the first item of the page.

People seeing this message by "Googling" the error, didn't read neither ;-)

Wednesday, July 25, 2007

APEX - Why limiting a column to 22 characters?

I probably had this problem before, but today I came across the same error again...

For a tabular form your Primary Key Column can't be more than 22 characters long.

I wonder why the APEX development team didn't limit that length to 30 characters, as it is in the Oracle database?

To make it even more strange, for a "normal" form your primary key column can exceed the 22 characters limit!

I know the APEX development team is working hard to improve the tabular forms, so if I'm allowed to give a suggestion: please remove the 22 character limit ;-)

(this discussion is not about if it's a good idea to make your column name that big)

Sunday, July 22, 2007

Oracle 11g after the webcast

James Burke believes that if you stand still you'll die, so I finally took the time to finish this post (after 10 days)...

During the Oracle 11g webcast I took some notes and screenshots, which I posted below.

A big portion of this webcast was about "Innovation" and "Managing Information".
Oracle wants to Innovate Faster (Oracle has 1500 developers working on the DB nowadays!) but they see some challenges:


Charles Philips stated only 3% of the world has been digitized. He thinks the biggest challenges for customers are the way to manage more and more complex data.

When you compare the innovations Oracle did during the last year, I'm glad I'm so Oracle minded ;-) Of course Oracle had to include the competition in the slide...


Where 10g was about "Grid", 11g is about "Scaling Grid". The next slide I find interesting too... When and why would customers upgrade their database?


The press release of the Oracle Database 11g you find here.
More technical information about 11g you find on OTN.
The whitepapers I like: Database 11g New Features and 11g Application Development
Do we see Oracle Application Express - APEX into these? Of course ;-)

Oracle Application Express (from 11g NF whitepaper)

Oracle Application Express, Oracle’s declarative, browser-based, rapid application
development tool for building database-centric applications, will be enhanced in the
Oracle Database 11g release timeframe with
  • New, prepackaged applications for popular functions such as blogs, discussion forums, surveys, bug tracking, and storefront
  • Reporting with Oracle Business Intelligence Publisher integration
  • Microsoft Access migration aids
  • Declarative Ajax support
  • Drag-and-drop form layout

Wednesday, July 11, 2007

Tuesday, July 10, 2007

Oracle APEX behind the Scenes: Logout Procedure

I was catching up with the forum when I spotted this thread: Adding a Process to Logout

Scott Spadafore, Oracle ACE and one of the developers of APEX, especially in the security area, explained what happened when you click the logout link in your Oracle APEX application.
(so for this post all credits go to him)

The built-in item LOGOUT_URL gives you access to the logout URL attribute of the current authentication scheme.
In referencing it as &LOGOUT_URL. or v('LOGOUT_URL'), or as a bind variable, the resulting attribute will have had basic substitutions performed on it first, e.g., for &APP_ID. and &APP_SESSION., facilitating its typical use as the target of a Navigation Bar Entry.

The standard logout URL (before substitutions) looks like:
wwv_flow_custom_auth_std.logout?p_this_flow=&APP_ID.&p_next_flow_page_sess=&APP_ID.:1
If you hover over this link in your application, you'll see that it's a full URL (host:port/pls/DAD/...) with substitutions completed and that the result of using the link is to execute the wwv_flow_custom_auth_std.logout procedure through modplsql.

Let's review the standard machinery:
What does the logout procedure do?
  1. Unsets your application's session cookie (actually sets it to '-1') and 2) redirects to the after-logout page.

  2. How does it know what cookie to unset?
    ...The cookie name is also an attribute of the curent application's authentication scheme so it looks it up.

  3. How does it know what the current application is since the logout procedure is not run in a "page request context"?
    ...The current application ID is a input parameter to the logout procedure (&p_this_flow=&APP_ID.).

  4. How does it know what page to show after logout?
    ...That's the other input to the logout procedure (&p_next_flow_page_sess=&APP_ID:1 where the application and page to redirect to are both given).

  5. But it looks like it goes to page 101 (login page) after logout.
    ...Yes, but the instructions were to redirect to page 1 after logout and if page 1 requires authentication, you have to login first. After login, you'll go to page 1.

How to create a custom logout procedure or call some DML during the logout operation?

A good way to do that is to change the logout URL in the authentication scheme to simply be a URL to a page in your application, say page 99:

f?p=&APP_ID.:99:&APP_SESSION.

On page 99 create a before-header process to call your DML procedure (or do the DML in the page process directly).
Then create a second process on the page (also an on-load vs. an after-submit process) that does:

apex_application.g_unrecoverable_error := true; 
wwv_flow_custom_auth_std.logout( p_this_flow=>:APP_ID,p_next_flow_page_sess=>:APP_ID ':1');
That should do it...

Wednesday, July 04, 2007

Oracle past 20!

Also having Oracle stock options?

For the first time in years Oracle passed the "20"-bounder!
I still have my Oracle stock options from the time I was an Oracle employee. ;-)


How comes this increase?
  • Did Oracle APEX expend that much? It's possible, but not the case in this graph ;-)
  • The reason behind that is probably the SAP (TomorrowNow) fight.
    More info in this article?