Trying to default date to sysdate on create
853243Dec 7 2011 — edited Dec 7 2011APEX - 4.1.0.00.32
DB version - 10g
Web server architecture - OHS
Browser - IE8
Theme - 5
Hello
I am trying to default a date to sysdate on create.
If I set "Default Value Type" to pl/sql expression and end sysdate in "default value", this works on a create, but also sets it if I view a record with a null in the date.
I tried to change the source to
declare
tmp_date date;
begin
if :P4_RECORDS_FILE_ID is not null then
select rf.oldest_record_date into tmp_date from RECORDS_FILE rf where rf.records_file_id = :P4_RECORDS_FILE_ID;
else
tmp_date := sysdate;
end if;
return tmp_date;
end;
This will set the date on create, but when I save it saves a null in the date field.
I just want the date to default to sysdate on an add and do nothing if viewing a record that has no start date.
Thank you in advance for any assistance.