Basically the page consists three items:
- A select list were the user can pick a product.
- A display item were the price of the product is shown.
- A display item were the supplier of the product is shown.
Task to accomplish
When the user selects a product, the values of price and customer had to change to the corresponding values in the database.
Steps to accomplish this task:
- Create a procedure which sends the price and supplier in Json-format depending on the product-id
create or replace procedure get_product_info (p_product_id in number)
t_sql := 'SELECT price, supplier FROM products WHERE id = '||p_poduct_id;
/*Print JSON result set*/
- Create a pl/sql page-process productInfo (point: on-demand)
get_product_info(p_product_id => :P3000_PRODUCT_ID);
//the application proces to be executes (prepare ajax-call)
var get = new htmldb_Get(null,&APP_ID., 'APPLICATION_PROCESS= productInfo',&APP_PAGE_ID.);
//set the value of product-id to the value of the item
//exceute the ajax-call and get the reponse in JSON format
var gReturn = get.get();
// make from the response string a JSON object
var obj = eval ("(" + gReturn + ")");
//set the value of the items, based on the response
For a customer i needed to call a external REST webservice to update an external database with some specific information.
With the use of the utl_http package Oracle has made this very simple.
I tried to make the procedure i made, self-explaining.
create or replace procedure call_rest_webservice
t_start_pos integer := 1;
/*Construct the information you want to send to the webservice.
Normally this would be in a xml structure. But for a REST-
webservice this is not mandatory. The webservice i needed to
call excepts plain test.*/
t_request_body := 'the data you want to send to the webservice';
/*Telling Oracle where the webservice can be found, what kind of request is made
and the version of the HTTP*/
t_http_req:= utl_http.begin_request( 'http://the_url_of_the_webservice'
/*In my case the webservice used authentication with a username an password
that was provided to me. You can skip this line if it's a public webservice.*/
/*Describe in the request-header what kind of data is send*/
utl_http.set_header(t_http_req, 'Content-Type', 'text/xml charset=UTF-8');
/*Describe in the request-header the lengt of the data*/
utl_http.set_header(t_http_req, 'Content-Length', length(t_request_body));
/*Put the data in de body of the request*/
/*make the actual request to the webservice en catch the responce in a
/*Read the body of the response, so you can find out if the information was
received ok by the webservice.
Go to the documentation of the webservice for what kind of responce you
should expect. In my case it was:
/*Some closing?1 Releasing some memory, i think....*/
Sometimes you want to call a page-proces, but do need to make a compleet refresh of the page by making a request.
In my case I made a simple master-detail screen with Tabs (Thank you Richard). In the tabs there are reports with a delete button for each row. For the delete operation I did not want refresh the complete page, but only wanted to call the page-proces I had written for the delete-operation and only wanted to refresh the report-region affected.
This is wat i did:
- I made a normal report and added an icon for the delete operation. The icon for the delete operation is the id-column in the report (PRODUCT_VERWIJZING_ID) and has the follwoing column link properties:
- link text: <img src=”#IMAGE_PREFIX#del.gif” alt=””>
- target: URL
After some testing en struggling with the Apex-tree item I decided to look for an alternative for an expanding and collapsable html-list.
Because of the integration with Jquery in apex, i obviously looked for an apex plug-in and found a really ease one.
The plug-in is written by Milaju and the source and documentation can be found at:
You can find a demo at:
How to integrate:
- Download the source-file from http://www.milaju.com/post/simple-jquery-expandcollapse-unordered-lists
- Extract the zip-file
- Go to Shared Components – Static files
- Upload the files “jquery.collapse.js” and “jquery.easing.js”. You do not need to upload the file “jquery.js”, because it’s already available within Apex
- Go to the page where you want to make the list
- Put in the region source:
- Make a new report region which makes the list-output as shown under. (the most important thing is to give the first ul-element the id “collapser” and keep the structure of the elements UL en LI the same)
- And voilà! The list is done! Easy, not?!
Wow, Richard and I have been strugling with APEX 4 on XE for hours before we came across this port:
It would have saved us hours.. thanks Marcin!
After default installation of Oracle APEX 3.0, remote users are not allowed to access Database home page (APEXconsole)
- http://hostname.com:8080/apex (not allowed by default from remote location)
This is because the listener local access setting is being set to local only by default.
To set HTTP Access to allow remote connects:
exec dbms_xdb.setListenerLocalAccess (l_access => FALSE);
To set HTTP Access back to Local only:
exec dbms_xdb.setListenerLocalAccess (l_access => TRUE);
Another way to set this up is to login to APEX dashboard as a sys user and navigate to: Home > Administration > Manage HTTP Access (Tasks’ list on the right side of the page) and change the settings: