Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Default Date and Time -

PJMay 15 2006 — edited May 17 2006
It took me a while to figure out how to do something as simple as ensure that I have default values for CREATED_DATE and LAST_UPDATED_DATE with time component on all tables. Not fully tested, but seems good, so I'll share - Maybe save someone else the pain for something that should be a no brainer ....

From my own notes:

---x snip x----

1. Maintain Created Date
========================

To populate:
------------
On DB Item Pn_CREATED_DATE, use Date Format Mask, and make Hidden.
For default value use PL/SQL expression with same format and use say:

to_char(sysdate,'DD-MON-YYYY HH24:MI:SS')


To display the value when needed:
---------------------------------
Create an item Pn_CREATED_DATE_DISPLAY, Disabled, Saves state.
Make conditional on hidden primary key, so only displays in 'Edit/Delete' mode.

Make source &P13_CREATED_DATE. (with dot)


2. Maintain LAST_UPDATED_DATE
=============================

Same principal as above. Set Format mask, and use the following default PL/SQL, because I don't want to populate it on first insert.

Expression

CASE :Pn_PRIMARY_KEY_ID
WHEN '' THEN ''
ELSE to_char(sysdate,'DD-MON-YYYY HH24:MI:SS')
END


Display as above using Pn_LASTUPDATED_DATE_DISPLAY

Make source &P13_LAST_UPDATED_DATE. (with dot)
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 14 2006
Added on May 15 2006
2 comments
981 views