在Oracle中检查字符格式 [英] Check for character format in Oracle
问题描述
可能是一个显而易见的问题,但是Oracle Technet对我的搜索术语并不友好.我想创建一个表,并让char列具有特定格式.例如,一个检查约束将确保插入的SSN字符串的格式为"###-##-####"(包括破折号).如何指定此检查?
probably an obvious question but Oracle Technet is not being friendly with my search terms on this. I want create a table and have a char column have a specific format. For example, a check constraint that would make sure the inserted SSN string is in the format "###-##-####" including the dashes. How do I specify this check?
推荐答案
以特定格式存储数据通常不是一个好主意.格式化只是一帆风顺,不同的情况可能需要不同的格式.向其中添加本地化,这显然不是一个好主意.
It is generally not a very good idea to store the data in a specific format. Formatting is just bells and whistles and different situations may need different formats. Add localization to this and it becomes more obvious that this is not be a great idea.
您希望在检索数据后进行格式化.可以通过格式模型来完成.
You would want to format after retrieving the data. This can be done by Format Models.
这篇关于在Oracle中检查字符格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!