Both date fields DATE_1 and DATE2 should have datatype as DATE and apply the format mask in property palette as 'DD-MON-YYYY' / 'DD-MON-RRRR'.
Now if you are entering date in DATE_1 field and want to have same in DATE2, you can do the assignment
:BLK.DATE2 := :BLK.DATE_1;
on when-validate-item trigger of BLK.DATE_1.
This is better if you are showing both date fields on screen.
If DATE2 is hidden, you can have the assignment on PRE-INSERT trigger of BLK datablock.
This will ensure that you are inserting same value in date fields.
Another method is use synchronize with item property for DATE2.
Hope this helps.
I import data from excel to forms i took date data as char into date1 which import sucessfully i want to convert those import date data into another item which is date datatype i tried the below codes on PRE-INSERT block level trigger but fail to achieve.
SELECT BLK.DATE1 INTO :BLK.DATE FROM DUAL;
how can i achive the task.
When importing date data as char - import it into a new item BLK.DATE1_CHAR, ensure that BLK.DATE1_CHAR is CHAR item and Non-database item.
The item BLK.DATE1 is DATE item and Database item and having format mask 'DD/MON/YYY'
And BLK.DATE is ofcourse DATE item and Database item and having format mask 'DD/MON/YYY'
Now on PRE-INSERT of BLK block, do the following:
:BLK.DATE1:=TO_DATE('BLK.DATE1_CHAR', 'DD/MON/YYY'); -- CHAR data to DATE and assign to DATE
:BLK.DATE:=:BLK.DATE1;-- copy DATE to another DATE;
This will ensure that you are inserting DATE in date fields (Note: DATE1 and DATE are columns in table with DATE datatype)
I dont understand the purpose of your last SELECT statement. Please explain.