Oracle database — Primary key ID Generating non repeating string functions sys_guid()

Prepare the pressure test server today , Ready to build 10W Data , But the primary key ID want Oracle Automatic database generation .

stay oracle8i A function for generating non duplicate data is provided later sys_guid() altogether 32 position , The main basis of generation is time and machine code , Unique in the world , be similar to java Medium UUID( They are the only ones in the world ).

Its application scenarios : When a field in the database is set to be unique , It can be generated automatically ( For example, the primary key );

Access method select sys_guid() from dual ;

Examples :
INSERT INTO “YG_IS”.“VIP_ACTUALSTORAGE_DETAIL” (“ID”, “STORAGENO”, “BARCODE”,
“PONO”, “AMOUNT”, “ACTUALAMOUNT”, “RETURNAMOUNT”, “DIFFERAMOUNT”, “CREATETIME”)
VALUES (sys_guid(), ‘2017031009-088’, ‘AF2U1345DU1AQ6230’, ‘2100118353’, ‘1’,
‘1’, ‘0’, ‘0’, TO_DATE(‘2017-03-14 16:45:27’, ‘SYYYY-MM-DD HH24:MI:SS’));

effect :

Technology
Daily Recommendation