I want a different sequence in a table for different values of a column (asterio).
I do this, but the use of dynamic creation and sequence is not how the essence of the problem can be involved?
Create a table Z_TEST (ID number, Acresize number, descriptor VARCHAR2 (200 bio)) logging noppress nasal nopperleal monitoring; Add optional table Z_TEST (contract Z_TEST_PK primary key (ID, ESERCIZIO)); Seconds Z_TEST_SEQ_2010 Get Started 1 MAXVALUE 99 9999 99999999999999999999999 MINVALUE 1 Nakseel Cash 20 Norder; Concurrent Concurrent Z_TEST_SEQ_2011 START with 1 MAXVALUE 999999999999999999999999999 MINVALUE 1 Nakseil Cash 20 Norder; Concurrent Concurrent Z_TEST_SEQ_2012 START with 1 MAXVALUE 999999999999999999999999999 MINVALUE 1 Nakseel Cash 20 Norder; Secondsend Z_TEST_SEQ_2013 Start with 1 Maxville 999999999999999999999999999 MINVALUE 1 Nakseel Cash 20 Norder; Concurrent Concurrent Z_TEST_SEQ_2014 START with 1 MAXVALUE 999999999999999999999999999 MINVALUE 1 Nakseel Cash 20 Norder; Concurrent Concurrent Z_TEST_SEQ_2015 Start with 1 Maxwell 999999999999999999999999999 MINVALUE 1 Nakseel Cash 20 Norder; Create or change trigger Z_TEST_TRG before INSERT at Z_TEST Incorrect digits of NUMBER for each row for the old old AS line; Err_msg VARCHAR2 (200); BEGIN if: select new.esercizio = 2010 then Z_TEST_SEQ_2010.nextval: double by new.ID; end if; If: select new.esercizio = 2011 then Z_TEST_SEQ_2011.nextval: double by new.ID; end if; If: new.esercizio = 2012 then choose Z_TEST_SEQ_2012.nextval in: new.id from dual; end if; If: new.esercizio = 2013 then select Z_TEST_SEQ_2013.nextval: double by new.ID; end if; If: select new.esercizio = 2014 then Z_TEST_SEQ_2014.nextval: double by new.ID; end if; If: select new.esercizio = 2015 then Z_TEST_SEQ_2015.nextval: double by new.ID; end if; Exceptions when other err_msg: = SUBSTR (SQLERRM, 1, 200); Err_code: = SQLCODE; DBMS_OUTPUT.put_line ('errore:' err_code || '' err_msg); End;
You summarize the problem by ignoring the requirement to do so; You are creating additional data that is not enabled in the current format; So you should not try to make it.
You can create a single sequence to populate your ID column and then generate your secondary sequence when analytical work is taken from the database using the function. Because a sequence always increases, you will continue to guarantee the "new" id column according to the order of the "old" id column.
For example:
select row_number () from the id (segment by ider esercizio order), z_test to descrizione
If you have to store it completely in a database for some reason, you may have a secondary process, it is at regular intervals.
To display errors, there is almost always a bad behavior for using DBMS_OUTPUT.PUT_LINE
, in production code. It is necessary that one should always stay there to see there, which will never be there. If you handle an error, then you need to do something with it.
I disagree with doing this, because there is no need for it, but if you want you can reference the speed in order:
each line For ZDTEST, make the trigger Z_TEST_TRG before INSERT or turn on 'select z_test_seq' immediately; : New.esercizio || || 'Double from nxtval' in: new.id; End;
Comments
Post a Comment