Home >Database >Mysql Tutorial >Oracle和Mysql诀别生成sequence序列

Oracle和Mysql诀别生成sequence序列

WBOY
WBOYOriginal
2016-06-07 16:25:321687browse

Oracle和Mysql分别生成sequence序列 有时候在往数据库中插入数据的时候,如果ID值是32位的UUID, 而自己随便写个字符又不合适,这时就要用到函数来产生一个序列值 Oracle: select sys_guid() from dual; Mysql: SELECT REPLACE(UUID(),'-','') FROM DUAL;

Oracle和Mysql分别生成sequence序列
有时候在往数据库中插入数据的时候,如果ID值是32位的UUID,

而自己随便写个字符又不合适,这时就要用到函数来产生一个序列值

Oracle:

select sys_guid() from dual;

Mysql:

SELECT REPLACE(UUID(),'-','') FROM DUAL;

因为mysql的UUID()生成的序列中间有'-'需要进行替换一下。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn