Oracle APEX Tips and Tricks + 40 Advanced MCQs with Answers (Developer Edition)
25 practical Oracle APEX tips and tricks from real projects (bind variables, Items to Submit, apex_string.split, APEX_ERROR, collections, JavaScript APIs, template directives) plus 40 scenario-based APEX MCQs with answers and explanations.
Oracle APEX · 25 tips · 40 MCQs
Oracle APEX Tips and Tricks + 40 Advanced MCQs with Answers
Part 1: 25 Oracle APEX tips and tricks
Session state and SQL
1. Always use bind variables in region SQL
Write WHERE dept_id = :P10_DEPT, never &P10_DEPT. in SQL. Substitution strings are replaced as text before parsing – a SQL injection risk and a new parse for every value. Bind variables are safe and let Oracle reuse the plan.
2. “Items to Submit” and “Items to Return” fix most Dynamic Action bugs
When an Execute Server-side Code action reads an item the user just changed, list it in Items to Submit – otherwise the server sees the old session value. When the code sets an item, list it in Items to Return so the new value appears in the browser.
3. Split colon-delimited values with APEX_STRING
Shuttles, checkbox groups and multi-select lists store values as 10:20:30. Use them in SQL like this:
SELECT *
FROM emp
WHERE deptno IN (SELECT column_value
FROM TABLE(apex_string.split(:P10_DEPTS, ':')));
4. Use Application Items for hidden, app-wide values
A user’s branch, company or role does not belong in a page item on every page. Create an Application Item, set it once with an Application Computation or Process at After Authentication (or on new session), and reference it as :G_BRANCH_ID anywhere.
5. Know the built-in substitution strings
:APP_USER, :APP_ID, :APP_PAGE_ID, :APP_SESSION and :REQUEST (the name of the button that submitted the page) save a lot of hard-coding. Use :REQUEST in server-side conditions when one process should run only for one button.
Validations, errors and processing
6. Show errors next to the field with APEX_ERROR
From a PL/SQL process, attach the message to the item instead of raising a generic error:
apex_error.add_error(
p_message => 'Quantity exceeds available stock.',
p_display_location => apex_error.c_inline_with_field_and_notif,
p_page_item_name => 'P20_QTY');
7. Remember the submit order
After submit APEX runs computations, then validations, then processes, then branches. A value you calculate in a process is not available to a validation that runs earlier – move it to an After Submit computation.
8. Tie validations to buttons
Set the validation’s server-side condition to When Button Pressed so a Delete or Cancel button is not blocked by “Name is required”.
9. Use :APEX$ROW_STATUS in Interactive Grid custom processing
In a custom PL/SQL save process, :APEX$ROW_STATUS is C (created), U (updated) or D (deleted). One CASE statement handles all three. More in our Interactive Grid guide.
10. Collections for session-only data
Shopping carts, import previews and wizard data can live in APEX_COLLECTION instead of temporary tables. Read members from the APEX_COLLECTIONS view (columns c001–c050, n001–n005, d001–d005):
apex_collection.create_or_truncate_collection('CART');
apex_collection.add_member('CART', p_c001 => 'ITEM-10', p_n001 => 2);
SELECT c001 item_code, n001 qty
FROM apex_collections
WHERE collection_name = 'CART';
JavaScript APIs that save time
11. apex.item, apex.region and apex.message
apex.item("P10_STATUS").setValue("APPROVED"); // fires change event
apex.region("orders").refresh(); // region Static ID = orders
apex.message.showPageSuccess("Order saved.");
12. Call PL/SQL from JavaScript with apex.server.process
apex.server.process("GET_PRICE",
{ x01: $v("P10_ITEM"), pageItems: "#P10_CUSTOMER" },
{ success: function (d) { apex.item("P10_PRICE").setValue(d.price); } });
In the Ajax Callback process, read apex_application.g_x01 and :P10_CUSTOMER, and return JSON with apex_json or htp.p.
13. Get selected Interactive Grid rows
var g = apex.region("emp_ig").widget().interactiveGrid("getViews", "grid");
var recs = g.getSelectedRecords();
recs.forEach(function (r) { console.log(g.model.getValue(r, "EMPNO")); });
14. Use “After Refresh” for code that must run when a region reloads
Anything that decorates report rows (colours, tooltips) must re-run after the region refreshes. Create a Dynamic Action on event After Refresh for that region instead of Page Load.
UI and components
15. Template directives instead of CASE in SQL
In Cards, HTML expressions and templates (APEX 21.2+):
{if IS_OVERDUE/}<span class="u-danger-text">Overdue</span>{else/}On time{endif/}
16. Popup LOV for big lists
A select list with 50,000 customers loads every row on every page view. A Popup LOV with search fetches only what the user types for.
17. Cascading LOVs need the parent set
Set Cascading LOV Parent Item(s) on the child (e.g. City depends on P10_COUNTRY) and reference :P10_COUNTRY in its query. The child refreshes automatically when the parent changes.
18. Put shared regions on the Global Page
Page 0 renders its regions on every page – ideal for a notification banner or help button. Use server-side conditions to hide them on pages where they do not belong.
19. Reference static files with #APP_FILES#
<img src="#APP_FILES#logo.png"> works after export and import to another environment; hard-coded URLs do not.
20. Faceted Search for report filtering
Instead of building ten filter items and a long WHERE clause, a Faceted Search region generates facets with counts from your query declaratively.
Security, deployment and integration
21. Turn on Session State Protection
Set page Page Access Protection to Arguments Must Have Checksum and protect sensitive items. Users can no longer change P10_EMP_ID=105 in the URL to open someone else’s record. Generate links in PL/SQL with apex_page.get_url so the checksum is added for you.
22. Evaluate authorization once per session when you can
If roles only change at login, set the authorization scheme’s evaluation point to Once per session – the role query runs once instead of on every page and component. See authorization schemes explained.
23. Never turn off escaping for user data
Setting a column’s Escape special characters to No and showing user-entered text opens the door to cross-site scripting. If you need HTML, build it in an HTML Expression and escape the data with apex_escape.html.
24. Build Options for features in progress
Mark unfinished pages, regions or processes with a Build Option set to Exclude in production. Nothing is deleted, and you switch it on when ready.
25. Export split files for version control
With SQLcl, apex export -applicationid 100 -split writes one file per component, so Git shows exactly which page changed. Combine with Supporting Objects for tables and seed data.
Part 2: 40 advanced Oracle APEX MCQs
Questions 1–10: session state and Dynamic Actions
1. What is the correct way to use page item P10_DEPT in a report’s SQL query?
&P10_DEPT.:P10_DEPTv('P10_DEPT')in every row#P10_DEPT#
Show answer
Answer: B. A bind variable is safe from SQL injection and lets Oracle reuse the parsed statement.
2. A Dynamic Action runs Execute Server-side Code that reads P5_QTY. The user changed P5_QTY, but the PL/SQL sees the old value. What is missing?
- A Set Value action
- A full page refresh
- P5_QTY in “Items to Submit”
- P5_QTY in “Items to Return”
Show answer
Answer: C. Only items listed in Items to Submit are sent to session state before the code runs.
3. The server-side code sets :P5_TOTAL, but the page still shows the old total. What fixes it?
- Add P5_TOTAL to Items to Submit
- Commit in the PL/SQL
- Change P5_TOTAL to a hidden item
- Add P5_TOTAL to “Items to Return”
Show answer
Answer: D. Items to Return sends the new session value back to the browser.
4. A user selects departments 10, 20 and 30 in a shuttle. What value does the item hold?
- 10,20,30
- 10:20:30
- A JSON array:
["10","20","30"] - Only 10
Show answer
Answer: B. Multi-value items are colon-delimited by default.
5. Which function turns that value into rows for IN (SELECT …)?
apex_string.splitapex_util.string_to_rowsdbms_utility.splitregexp_split
Show answer
Answer: A. TABLE(apex_string.split(:P10_DEPTS, ':')) returns one row per value.
6. A value such as the user’s branch is needed on every page but never displayed. Where should it live?
- A hidden item on every page
- A cookie
- An Application Item
- A package variable
Show answer
Answer: C. Application Items hold session state for the whole application without appearing on any page. Package variables do not survive between requests.
7. How should that branch value be set once, right after login?
- A Dynamic Action on page 1
- A database trigger on the users table
- A page computation on every page
- An Application Computation or Process at “After Authentication”
Show answer
Answer: D. It runs once per login, and every page can then read the item.
8. One page has Save and Delete buttons. How does a PL/SQL process know which was clicked?
:REQUESTholds the button name:APP_BUTTONapex_application.g_button- It cannot know
Show answer
Answer: A. Submitting buttons set REQUEST to their name. Server-side condition “When Button Pressed” uses the same mechanism.
9. An item’s source is a database column and it also has a default value. When is the default used?
- Always, overriding the column
- Only when the source returns NULL
- Only on submit
- Never
Show answer
Answer: B. Defaults fill empty items, typically on a new-record form.
10. Code that colours report rows stops working after the report is filtered. Which event should the Dynamic Action use?
- Page Load
- Change
- Before Refresh
- After Refresh
Show answer
Answer: D. The region’s HTML is replaced on refresh, so decoration must run again after it.
Questions 11–20: security and JavaScript
11. Users change P10_EMP_ID in the URL to open other employees’ records. What prevents this?
- Making the item read-only
- Hiding the item
- Session State Protection with “Arguments Must Have Checksum”
- Using POST instead of GET
Show answer
Answer: C. Tampered URLs fail the checksum. Your queries should still check that the user may see the record.
12. Which PL/SQL API builds a URL that includes the required checksum?
apex_page.get_urlowa_util.get_urlapex_util.redirectutl_url.escape
Show answer
Answer: A. It also builds friendly URLs and clears cache when asked.
13. An authorization scheme runs an expensive role query, and roles only change at login. Best evaluation point?
- Always (no caching)
- Once per page view
- Once per component
- Once per session
Show answer
Answer: D. The result is cached for the session. Use a shorter point only when roles can change mid-session.
14. What is the main risk of setting “Escape special characters” to No on a column with user-entered text?
- Slower sorting
- Cross-site scripting (XSS)
- Broken CSV export
- The column cannot be filtered
Show answer
Answer: B. Script typed by one user would run in other users’ browsers.
15. Which call sets an item’s value and triggers its change event?
$s("P1_X") = "A"document.P1_X = "A"apex.item("P1_X").setValue("A")apex.page.set("P1_X","A")
Show answer
Answer: C. The $s("P1_X","A") shortcut does the same thing.
16. How do you refresh a region whose Static ID is orders?
apex.region("orders").refresh()$("#orders").reload()apex.refresh("orders")- Only by submitting the page
Show answer
Answer: A. Set a Static ID on the region first; the internal region ID changes between environments.
17. Which API calls an Ajax Callback (On Demand) PL/SQL process from JavaScript?
apex.ajax.runfetch('/process')apex.page.submitapex.server.process
Show answer
Answer: D. It handles the session, security and JSON response for you.
18. In the callback, how do you read the value passed as x01?
:x01apex_application.g_x01v('X01')owa_util.x01
Show answer
Answer: B. Page items sent with the pageItems option are read as normal bind variables.
19. Which Interactive Grid view method returns the rows the user selected?
getRows()getChecked()getSelectedRecords()selection()
Show answer
Answer: C. Get the grid view first with interactiveGrid("getViews","grid"), then read values through its model.
20. Which API shows a green success message without reloading the page?
apex.message.showPageSuccessalert()apex.debug.infoapex.notify.ok
Show answer
Answer: A. apex.message.showErrors displays error messages the same way.
Questions 21–30: components and UI
21. Best item type for choosing from 50,000 customers?
- Select List
- Radio Group
- Checkbox Group
- Popup LOV with search
Show answer
Answer: D. It only fetches rows matching what the user types.
22. A City list must refresh when Country changes. Which attribute makes this declarative?
- Dependent Items
- Cascading LOV Parent Item(s)
- Refresh On
- Source Used
Show answer
Answer: B. Reference the parent (e.g. :P10_COUNTRY) in the child’s LOV query.
23. A notification banner must appear on every page. Where should the region go?
- Page 0 (Global Page)
- Page 1 with a branch
- The login page
- A theme template file
Show answer
Answer: A. Global Page regions render on all pages; use conditions to exclude some.
24. How should you reference logo.png uploaded as an application static file?
/i/logo.png- The full https:// URL of the dev server
#APP_FILES#logo.png&LOGO.
Show answer
Answer: C. It resolves correctly in every workspace and after import.
25. Which template directive shows text only when STATUS has a value?
<% if STATUS %>{{#STATUS}}#IF STATUS#{if STATUS/}…{endif/}
Show answer
Answer: D. Directives also support {else/} and {case/}.
26. Which region type adds filter facets with counts next to a report declaratively?
- Faceted Search
- Smart Filters only on Classic Reports
- Region Display Selector
- Tree
Show answer
Answer: A. Faceted Search (and the compact Smart Filters) filter a linked report region.
27. In an Interactive Grid custom PL/SQL save process, which value tells you the row was deleted?
:APEX$ROW_ACTION = 'DEL':APEX$ROW_STATUS = 'D':REQUEST = 'DELETE'SQL%DELETED
Show answer
Answer: B. C = created, U = updated, D = deleted.
28. Where do you store per-session cart lines without creating a table?
- Page items
- Global temporary table only
- APEX collections
- Browser localStorage only
Show answer
Answer: C. Collections are per session and cleaned up when the session ends.
29. Which view do you query to read collection members?
APEX_COLLECTION_DATAUSER_COLLECTIONSAPEX_SESSION_STATEAPEX_COLLECTIONS
Show answer
Answer: D. Filter by collection_name; data is in c001–c050, n001–n005 and so on.
30. How do you keep an unfinished page out of production without deleting it?
- Mark it with a Build Option set to Exclude
- Rename it
- Remove it from navigation only
- Set its authorization to “Must Not Be Public User”
Show answer
Answer: A. Excluded components are not rendered or run, and can be switched on later.
Questions 31–40: processing, deployment and newer features
31. In which order does APEX run components after a page is submitted?
- Processes, validations, computations, branches
- Validations, computations, branches, processes
- Computations, validations, processes, branches
- Branches, processes, validations, computations
Show answer
Answer: C. That is why a process cannot prepare a value that a validation needs.
32. A “Name is required” validation blocks the Cancel button. Best fix?
- Delete the validation
- Make Cancel a link that does not submit, or limit the validation with “When Button Pressed”
- Make the item optional in the table
- Add a JavaScript alert
Show answer
Answer: B. Validations should only run for the buttons that save data.
33. Which API shows an error next to P20_QTY from PL/SQL?
dbms_output.put_linehtp.praise_application_erroronlyapex_error.add_errorwithp_page_item_name
Show answer
Answer: D. Use display location c_inline_with_field_and_notif.
34. Emails sent with APEX_MAIL.SEND are waiting in the queue. Which call sends them now?
apex_mail.push_queueapex_mail.flushcommitaloneutl_smtp.send
Show answer
Answer: A. Otherwise a background job sends them a few minutes later. Details in our APEX_MAIL guide.
35. Where do you set the text shown after a process completes successfully?
- Page footer
- The process’s “Success Message” attribute
- A branch
- The button label
Show answer
Answer: B. The message appears on the page the user lands on after the branch.
36. Which substitution string holds the current page number?
:PAGE_NO:APP_PAGE:APP_PAGE_ID:CURRENT_PAGE
Show answer
Answer: C. Useful in shared components and Global Page conditions.
37. Which declarative component consumes an external REST API as a data source for reports and forms?
- Web Service Reference only
- Database link
- Application Process
- REST Data Source
Show answer
Answer: D. Regions can use it like a table. See our REST integration guide.
38. Which APEX feature models approvals with initiators, approvers and task actions?
- Task Definitions (Approvals component)
- Build Options
- Shared LOVs
- Plug-ins only
Show answer
Answer: A. Tasks appear in a Unified Task List for each approver.
39. A month-end process runs for 10 minutes and the browser times out. Declarative fix in recent APEX versions?
- Increase the browser timeout
- An Execution Chain set to run in background
- Split it into 10 buttons
- Run it in JavaScript
Show answer
Answer: B. Background execution lets the user continue and check progress later. A scheduler job is the alternative in older versions.
40. Which command exports an application as one file per component for Git?
expdp app=100apex_export.fullto one file- SQLcl
apex export -applicationid 100 -split - Copy the page from the browser
Show answer
Answer: C. Split files make code reviews and merges far easier.
What to practise next
Scored 32 or more? You are ready for most mid-level APEX interviews. Practise next with the 25 APEX interview questions and the APEX & Forms quiz with instant score. For the PL/SQL side of APEX, try the PL/SQL MCQs and our guide to fixing slow APEX pages.
Need an Oracle APEX developer?
AbairTech builds and fixes Oracle APEX applications and migrates Oracle Forms to APEX.