In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
If you haven't already created the table, you can do it in the following way.
Create table testuu (
Id varchar2 (2000) default sys_guid ()
Name varchar2 (2000))
If you have already created a table, make sure that your original primary key ID does not have any real business meaning, and use the following method to modify it.
Alter table testuu modify id default sys_guid ()
Update testuu set id = sys_guid ()
When Oracle creates a new system table, the primary key is required to be 32-bit uuid, and it is guessed that Oracle will certainly provide related functions.
Looking through the relevant documents, it is found that the function sys_guid () provided by Oracle is used to get 32-bit uuid, which is simply used as
Select sys_guid () from dual
This function returns 32-bit uuid in uppercase and can be converted to lowercase using lower (sys_guid ()).
It is very convenient to generate cross-system unique identifier UUID in Oracle, which is simpler than generating sequence. Just use sys_guid () directly.
For example, select sys_guid () from dual produces a 32-bit hexadecimal random number related to the MAC address and generation time.
The data type is raw (16) with 32 characters.
Its generation mechanism is sufficient to ensure that the possibility of massive guid repetition generated by all systems in the world is very small. This is very important in the AIXM concept.
Splicing according to time:
Select lower (sys_guid ()) | | to_char (sysdate,'yyyyMMddHh34miss') from dual
If you want the returned uuid to meet the standard format, you can use the following function:
CREATE OR REPLACE FUNCTION
Get_uuid RETURN VARCHAR IS guid VARCHAR (50)
BEGIN guid: = lower (RAWTOHEX (sys_guid ())
RETURN substr (guid,1,8) | |'-'| | substr (guid,9,4) | |'-'| | substr (guid,13,4) | |'-'| | substr (guid,17,4) | |'-'| | substr (guid,21,12) |
END get_uuid
SQL > select get_uuid from dual
GET_UUID
A8f662b8-6e7a-13fe-e040-970a437c6bd7
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.