This content has been marked as final. Show 2 replies
I don't believe sequence numbers can be generated automagically just yet. But that's coming in Oracle 12C, I hear. There are ways to get random number in APEX. But, would you consider an alternative? Create your own sequence and populate the key field from the sequence with an INSERT trigger on the table? That's pretty straight-forward once you've done it.
CREATE SEQUENCE <table-name>_SEQ START WITH 1 INCREMENT BY 1 NOMINVALUE NOMAXVALUE NOCYCLE ORDER NOCACHE; GRANT SELECT ON <table-name>_SEQ TO <some-user>_ROLE;
Edited by: Howard (... in Training) on Feb 11, 2013 11:12 AM
create or replace trigger <table-name>_INSERT before insert on <table-name> for each row BEGIN select <table-name>_SEQ.nextval into :new.<primary-key-column-name> from dual; end <table-name>_INSERT; / SHOW ERRORS
Thats fantastic your a star, thats exactly what I'm looking for!! I'll report back here in the next few days if it goes wrong, but I've used that method for 2 of my tables now and tried multiple inserts and its working perfectly.
Thank you! :)