A Real-World Lesson on Passing Page Items Safely in Oracle APEX
π The Issue Faced in Production
Recently, I have faced a critical production error while navigating from a report page (Page 29) to an Edit page (Page 31).
Users were clicking the Edit icon, and suddenly this error appeared:
Invalid numeric value King for column EMPNO
ORA-06502: PL/SQL numeric or value error: character to number conversion error
It was working perfectly in most casesβ¦
But failing for one specific employee:
KING,KingAnd that comma was the root cause.
π§ What Was Happening?
On Page 29, we had a report with an Edit link passing values to Page 31 using Set Items.
Link Builder Configuration
- P31_ENAME β #ENAME#
- P31_EMPNO β #EMPNO#
Everything looked correct.
But when ENAME contained a comma:
KING,KingAPEX interpreted the comma as a separator between multiple URL parameters.
So instead of:
P31_ENAME = KING,KingIt interpreted as:
P31_ENAME = KING
P31_EMPNO = KingNow here is the problem:
- P31_EMPNO expects NUMBER
- It received King (VARCHAR2)
π₯ Boom β ORA-06502 numeric conversion error.
πΈ Error Screenshot

APEX Error Code:
WWV_FLOW_DML.DML_INVALID_NUMBER_ERRπ Root Cause Analysis (RCA)
In APEX URL structure, commas , are used as separators when passing multiple item values in a link.
When free-form text contains:
- Comma ,
- Special characters
- Rich text
APEX may split values incorrectly if not handled properly.
Thatβs exactly what happened.
β The Fix
To escape special characters properly while passing page items in Link Builder, we must enclose page item values with backslashes:
\P31_NAME\Correct Link Setup
Instead of:
#ENAME#Use:
\#ENAME#\
This ensures APEX treats the entire value as one string β even if it contains commas.
π Why This Works
Backslashes instruct APEX:
βTreat everything inside as a single parameter value.β
So now:
KING,KingRemains:
P31_ENAME = KING,KingAnd does NOT spill into the next parameter.
π Lesson Learned
Whenever passing:
β Free-form text
β Rich text
β Values that may contain commas
β User-entered content
π Always escape the page item using backslashes.
π‘ Best Practices Moving Forward
- Never assume text will be βcleanβ
- Escape page items when passing via URL
- Test with edge-case data (commas, quotes, special characters)
- Understand how APEX URL parameter parsing works
- Use apex_util.prepare_url when possible
π― Final Thought
This issue was small in appearanceβ¦
But critical in production.
It reminded me that:
In Oracle APEX, URL parameter handling is powerful β but must be handled carefully.
One comma cost us production downtime.
One backslash fixed it.
π If youβre working in Oracle APEXβ¦
Test with:
- Commas
- Quotes
- Special characters
- Rich text values
Because production data will always surprise you.
Love coding? Me too! Letβs keep in touch β subscribe to my website for regular chats on Oracle APEX, PL/SQL,SQL JavaScript, and CSS.