DB2 Luw 支持 CHAR 语义吗?

发布于 2025-01-13 09:12:52 字数 256 浏览 3 评论 0原文

Oracle创建表时支持Byte和Char语义

  1. Create table test(n varchar2(10 byte);

  2. 创建表 test(n varchar2(10 char);

DB2 Luw 是否支持带有 char 语义的第二个创建语句?

如果我们知道第 n 列中的某些值可能需要多个字节而我不知道,我们可以在 DB2 Luw 中做什么?不想使用 nvarchar?

Oracle supports Byte and Char Semantic when creating table

  1. Create table test(n varchar2(10 byte);

  2. Create table test(n varchar2(10 char);

Does DB2 Luw support the second create statement with char Semantic?

What can we do in DB2 Luw if we know that some values in the column n may require more than one byte and i don't want to use nvarchar?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

傾城如夢未必闌珊 2025-01-20 09:12:52

当前支持的 Db2-LUW 版本在正确配置为模拟 Oracle 时将接受以下语法:

Create table test(n varchar2(10 byte);

Create table test(n varchar2(10 char) );

默认情况下,Db2-LUW 安装不会启用 Oracle 兼容性,但您可以按照 文档

。根据您的需要设置注册表变量DB2_COMPATIBILITY_VECTOR之后创建此配置活动通常由 DBA 完成(

如果您的 Db2 数据库没有) 。支持此语法,那么当您尝试使用 Oracle 语法时,Db2-LUW 将报告错误 SQL0104N。

Currently supported versions of Db2-LUW when correctly configured to emulate Oracle will then accept the syntax:

Create table test(n varchar2(10 byte);

and

Create table test(n varchar2(10 char);

By default, Db2-LUW installations will not enable Oracle compatibility, but you can change this by following the documentation.

Remember that a new database has to be created after you set the registry variable DB2_COMPATIBILITY_VECTOR according to your needs. This configuration activity is normally done by a DBA.

If your Db2-database does not support this syntax, then Db2-LUW will report the error SQL0104N when you try to use Oracle syntax.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文