Tag Info

New answers tagged

0

If your auto-increments do have a meaning outside of an arbitrary indentifier, maybe they shouldn't be auto_increments, but simple int or bigint unsigned. You can drop the auto_increment particle and just insert max(id)+1, but that would create you all sorts of concurrency problems (that the auto_increment solves for you automatically). You could store the ...


1

You have to use UUID() function that guarantee that returned string is unique not only within your table or database but all over the world. http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html#function_uuid A UUID is designed as a number that is globally unique in space and time. Two calls to UUID() are expected to generate two ...


0

You can have almost any field as the primary key and index it as such. However it would be down to the logic further up the stack (your scripting language most probably to provide unique IDs. You will almost definitely find yourself making additional queries to find unused IDs as the DB grows. One approach to alpha numeric to numeric conversion would be a ...


6

Well it does now - Oracle 12c introduced IDENTITY columns, see: Identity Columns in Oracle Database 12c Release 1 (12.1) e.g. CREATE TABLE identity_test_tab ( id NUMBER GENERATED ALWAYS AS IDENTITY, description VARCHAR2(30) );


3

Because the value is incremented outside the scope of the transaction. This is the way you want it to work, so that separate transactions can happily insert rows or roll back without waiting for each other. If you care about gaps or want different behavior, stop using the built in and roll your own...



Top 50 recent answers are included