加入收藏 | 设为首页 | 会员中心 | 我要投稿 宁德站长网 (https://www.0593zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

varchar2(n)和varchar2(n char)之间的Oracle SQL区别

发布时间:2021-03-30 16:03:21 所属栏目:百科 来源:网络整理
导读:这里的脚本总是将varchar2列声明为varchar2(n char).我没有看到任何差异,只是好奇.谢谢! 解决方法 基于 this resource Oracle9i and above allow Varchar2 columns to be defined as a number of bytes VARCHAR2(50 BYTE) or a number of characters VARC

这里的脚本总是将varchar2列声明为varchar2(n char).我没有看到任何差异,只是好奇.谢谢!

解决方法

基于 this resource

Oracle9i and above allow Varchar2 columns to be defined as a number of bytes VARCHAR2(50 BYTE) or a number of characters VARCHAR2(50 CHAR),the latter is useful if the database is ever converted to run a double-byte character set (such as Japanese),you won’t have to edit the column sizes. The default measure,normally BYTE,is set with nls_length_semantics.

If you create a column as Varchar2 (50) but only store 10 bytes,then Oracle will only save 10 bytes to disc. This does not mean that you should just create Varchar2 (4000) columns ‘just in case the space is needed’,that is a really bad idea which will reduce the performance and maintainability of your application.

(编辑:宁德站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!