Home > Database > Mysql Tutorial > body text

Oracle和Mysql诀别生成sequence序列

WBOY
Release: 2016-06-07 16:25:32
Original
1658 people have browsed it

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;
Copy after login

Mysql:

SELECT REPLACE(UUID(),'-','') FROM DUAL;
Copy after login

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!