Hi All,
APEX 4.2.4. Oracle XE 11.2
I'm trying to add a default value from a sequence to a tabular column field, so that it populates when I hit the 'Add Row' button..
The reason for this by the way, rather than just using a database Sequence and trigger on the column (which exists and works fine), is that I'm also trying to add detail records to the row when I create it, and I cannot unless I have the parent ID to pass to the Child records.
Looking at the docs, (for example pl/sql enhancements in oracle 11g), I thought Id have be able to use a PL/SQL expression such as to_char(petty_cash_seq.NEXTVAL) or to_number(petty_cash_seq.NEXTVAL) or any such expression that retrieves the sequence.nextval, as this became available in PL/SQL on Database
so, Ive tried
to_char(petty_cash_seq.NEXTVAL) in tabular form attributes - default column / PL/SQL expression, and it tells me ORA-02287: sequence number not allowed here...
Ive also tried wrapping it up in a PL/SQL package, as below:
DECLARE v_seq_value NUMBER; BEGIN select petty_cash_seq.NEXTVAL into v_seq_value from dual;return v_seq_value; END;
and I get ORA-00923: FROM keyword not found where expected...
Can anyone help as to why either of these don't appear to work as an expression / package in the default type??
or..... a simple alternative to get the ID of the next record when I hit 'Add Row' so that I can create child records at the same time...
And I have been mulling over the merits of master / detail integrity, and trying to think of a neat way to create the master, add the details without having to submit the master first, then go back and enter details.... And to put it in context, its an expense application where users create an expense entry, and upload copies of their expenses at the same time...
Many Thanks
Richard