Home  >  Article  >  Database  >  Oracle和MySQL分别生成sequence序列

Oracle和MySQL分别生成sequence序列

WBOY
WBOYOriginal
2016-06-07 16:49:181055browse

有时候在往数据库中插入数据的时候,如果ID值是32位的UUID, 而自己随便写个字符又不合适,这时就要用到函数来产生一个序列值 Or

有时候在往数据库中插入数据的时候,如果ID值是32位的UUID,

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

Oracle:

select sys_guid() from dual;

MySQL:

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

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

以下内容你也可能喜欢:

ORA-01002: fetch out of sequence 

判断Oracle sequence是否存在

Oracle 中的sequence用法

Oracle利用触发器和sequence实现主键自增长

Oracle中sequence使用的限制

Oracle创建自增字段sequence

本文永久更新链接地址:

linux

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