In Oracle APEX, the Comments component is a built-in, ready-to-use feature that allows users to post and view comments associated with a record. It is particularly useful in applications that involve collaboration, such as task management, help desk systems, or project tracking. By using the Comments component, developers can quickly implement threaded discussions or simple commenting functionality without needing to build it from scratch.
Understanding the Comments Component
The Comments component in APEX is available as a plug-in region type. It provides a styled interface where users can submit text comments related to a primary record, such as a task, issue, or ticket. The region handles rendering, insertion, and display automatically, using a declarative setup.
How to Use the Comments Component in Oracle APEX
Here is a step-by-step guide to implement the Comments component on a page:
Step 1: Prepare the Comments Table (Optional)
Oracle APEX can use a built-in comment model or a custom table. If you want to use your own table, it should contain at least the following fields:
CREATE TABLE issue_comments (
id NUMBER GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
issue_id NUMBER,
comment_text CLOB,
created_by VARCHAR2(255),
created_on DATE DEFAULT SYSDATE
);
Make sure there is a foreign key like issue_id
to link the comment to a parent record.
Step 2: Add a Comments Region
-
In App Builder, edit the desired page (e.g., a task or issue detail page).
-
Click + Add Region.
-
Choose Comments from the list of region types (under the "Reports" or "Plug-ins" section).
-
Configure the region’s Source:
-
Set the Primary Key Item to the item holding the parent record ID (e.g.,
:P10_ISSUE_ID
). -
Choose the Comments Table if using a custom one, or use the default if you prefer built-in storage.
-
Step 3: Configure Display and Behavior
-
Under Appearance, set options like maximum number of comments to show, display order, and comment box size.
-
You can allow users to delete or edit their own comments.
-
For applications that use login,
APP_USER
is automatically captured as the commenter.
Step 4: Apply Security and Access Control
-
You can restrict comment submission to authenticated users only.
-
Use Authorization Schemes if only specific roles should view or add comments.
Step 5: Test the Comments Feature
Run the page, load a record, and try adding comments. You should see your entries displayed in real time, with timestamps and usernames captured.
Examples
Example 1: Bug Tracker
-
Page: Bug Detail (P20)
-
Comments Region: Linked via
:P20_BUG_ID
-
Users can post updates, ask for clarification, or close discussions.
Example 2: Task Manager
-
Page: Task Detail (P30)
-
Comments Region: Uses
task_comments
table -
Logged-in users can leave status notes or collaboration feedback.
Best Practices
-
Always link the Comments component to a unique identifier for the parent record (e.g., task_id, issue_id).
-
Use APEX session items like
APP_USER
to capture who made the comment. -
Limit comment length using validations or custom logic.
-
Sanitize or escape displayed content if pulling from raw CLOB fields to avoid XSS issues.
-
Consider including comment timestamps and usernames for audit trail purposes.
-
Use conditional rendering to show the component only when a valid parent record is present.
Basic comments
Using the following query:
select 1 as ID,
'JK' as AVATAR_INITIALS,
'1 minutes ago' as COMMENT_DATE,
'Test 1' as COMMENT_TEXT,
'Joel' as USER_NAME
from sys.dual
union all
select 2 as ID,
'JK' as AVATAR_INITIALS,
'2 minutes ago' as COMMENT_DATE,
'Test 2.' as COMMENT_TEXT,
'Joel' as USER_NAME
from sys.dual
union all
select 3 as ID,
'JK' as AVATAR_INITIALS,
'3 minutes ago' as COMMENT_DATE,
'Test 3.' as COMMENT_TEXT,
'Joel' as USER_NAME
from sys.dual
Final Outcome:
Basic Chat comments
Using the following query:
select p.ID,
p.CREATED as COMMENT_DATE,
lower(p.CREATED_BY) as USER_NAME,
t.CREATED as TASK_CREATED,
t.TASK_NAME || ' - ' || t.CREATED_BY as COMMENT_TEXT
from EBA_UT_CHART_TASKS t,
EBA_UT_CHART_PROJECTS p
where t.PROJECT = p.ID
order by t.CREATED
Final Outcome
For official documentation and advanced configuration options:
https://docs.oracle.com/en/database/oracle/apex
Search for "Comments Region" or "Region Types – Comments" to get detailed guidance.
Conclusion
The Comments component in Oracle APEX simplifies the process of adding comment functionality to your applications. With minimal configuration, you can provide users with a familiar and functional way to interact, give feedback, or track discussions tied to specific records. Whether you’re building a help desk system, project tracker, or internal workflow app, using the Comments region enhances collaboration while saving development time.