Assigning a default value to an apex item can be tricky especially when you want to use sql expression. I often get confused whether to use just sql express or the sql statement.
I wanted to create a default value computed as today’s date plus a number of months coming from a database table. Here’s how you do it.
- Create an apex item
- source: set null
- default value type : Expression
- default language: SQL
- default SQL expression: add_months(sysdate, (select months from mytable where mytable_id = :PXX_mytable_id)
My error came from using SQL statement (select add_months(……) )instead of expression (add_months). Hope this helps!