我们使用 UUID 作为 out oracle DB 的主键,并尝试为 VARCHAR 确定适当的最大字符长度.显然这是 36 个字符,但我们注意到生成的 UUID 比这更长 - 长度最多为 60 个字符.有谁知道 UUID 合适的最大字符长度??
We are using UUID as primary key for out oracle DB, and trying to determine an appropriate max character length for the VARCHAR. Apparently this is 36 characters but we have noticed UUID'S generated which are longer than this - up to 60 characters in length. Does anyone know a suitable max char length for UUID??
推荐答案RFC4122 的第 3 节 提供了 UUID 字符串表示的正式定义.它是 36 个字符(32 个十六进制数字 + 4 个破折号).
Section 3 of RFC4122 provides the formal definition of UUID string representations. It's 36 characters (32 hex digits + 4 dashes).
听起来您需要弄清楚无效的 60 字符 ID 的来源并决定 1) 是否要接受它们,以及 2) 这些 ID 的最大长度可能基于所使用的任何 API生成它们.
Sounds like you need to figure out where the invalid 60-char IDs are coming from and decide 1) if you want to accept them, and 2) what the max length of those IDs might be based on whatever API is used to generate them.
更多推荐
UUID 最大字符长度
发布评论