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!

How to set a date default value with time mask in a form page?

A. PENGJul 4 2020 — edited Jul 5 2020

Hi, experts:

In Apex 20.1.

In order to set a defualt value for a date type field in a form page when the page was first opened. The fowllowing steps have been done:

1. Create a form page (Page number is 14) based on a table with a date type field , for example :revise_date;

2. Set this date type field of the page's (P14_REVISE_DATE) atrributes:

Format Mask as: YYYY-MM-DD HH24:MI:SS

Default: SQL Query

Select sysdate From dual;

3. when the page is running, the P14_REVISE_DATE field shows with the time stamp: 2020-07-04 00:00:00, But it should be

2020-07-04 16:00:00  now.

4.if I change the P14_REVISE_DATE field  to some other value, i.e :2020-07-04 16:00:00. It can be saved .

But I can only change it but entering the time value.and cannot do it by selecting the date in calander,

Even if I select Today in the calender .the selected time is still show 2020-07-04 00:00:00

5.SO i tried to set Default SQL Query for this field as :

Select TO_DATE(TO_CHAR(sysdate,'YYYY-MM-DD HH24:MI:SS'),'YYYY-MM-DD HH24:MI:SS') From dual;

But this SQL Query will not pass the validation, an error is raised:

ORA-20999: Column name "TO_DATE(TO_CHAR(SYSDATE,'YYYY-MM-DDHH24:MI:SS'),'YYYY-MM-DDHH24:MI:SS')" is invalid for the LOV SQL query. Make sure that you use valid alias names for your columns.

Can anyone gives suggestions to solve these issues?

Thanks !

This post has been answered by Keyser on Jul 5 2020
Jump to Answer
Comments
Post Details
Added on Jul 4 2020
5 comments
5,424 views