I think this example would be perfect for you to work from, to get you started
Bare in mind if you're working with a date item, you should use explicit conversion (session state uses strings), hence something like to_date(:P1_DATE_FIELD)
Thank you for your answer Scott.
Probably my error is in the use of date fields and the sintax .
I try with:
:P22_DAT_AMMORTISSEMENT := add_months(:P22_DAT_FACTURE, 60);
to_date(:P22_DAT_AMMORTISSEMENT) := add_months(to_date(:P22_DAT_FACTURE), 60);
and I try the statent with onli
:P22_DAT_AMMORTISSEMENT := to_date(:P22_DAT_FACTURE);
but I have this error:
Ajax call returned server error ORA-06550: line 1, column 67:
PLS-00103: Encountered the symbol "=" when expecting one of the following:
. ( * @ % & = - + ; < / > at in is mod remainder not rem
<an exponent (**)> <> or != or ~= >= <= <> and or like like2
like4 likec between || indicator multiset member submultiset
ORA-06550: line 2, column 2:
PLS-00103: Encountered the symbol "END" when expecting one of the following:
begin function pragma procedure subtype type <an identifier>
<a double-quoted delimited-identifier> cur for Set Value.
PL/SQL Expression just means you need
no need for assignment, that's what "Affected element" setting is for
'ADD_MONTHS' is not a procedure or is undefined
i think this is because add_months is a function returning a value
:P22_DAT_AMMORTISSEMENT := add_months(TO_DATE(:P22_DAT_FACTURE), 60);
PL/SQL Expression is different to executing pl/sql code.
please, on P22_DAT_FACTURE create a dynamic action as follows (keep the client-side condition as is):
Action: Set Value
Set Type: PL/SQL expression
PL/SQL Expression: add_months(to_date(:P22_DAT_FACTURE , :app_nls_date_format),60)
Affected Elements => Item(s): P22_DAT_AMMORTISSEMENT
Item(s) to Submit: P22_DAT_FACTURE
As had been already mentioned above, all items in APEX are stored as varchar2, so explicit to_date conversion is needed but you also need to tell this function the date format. The date format is stored in the APP_NLS_DATE_FORMAT application variable https://docs.oracle.com/database/121/HTMDB/concept_sub.htm#CHDJHCJD .