如何将列默认值从DB2复制到Oracle(How to replicate column default value from DB2 to Oracle)

编程入门 行业动态 更新时间:2024-10-09 02:29:03
如何将列默认值从DB2复制到Oracle(How to replicate column default value from DB2 to Oracle)

我正试图查看是否有可能将从DB2到DB2的行为复制到Oracle中,该行为与在表的列中设置默认值有关。

在DB2中:

. . mychar CHAR(8) NOT NULL WITH DEFAULT SESSION_USER, . .

我理解如何在oracle中做一些事情,比如将默认值设置为特定字符串,但是我不确定是否存在与DB2等效的Oracle,允许您将SESSION_USER设置为默认值。

我是否需要通过触发器和存储过程获得创意? 有更容易的方法吗?

I am trying to see if it is possible to replicate a behavior from DB2 over to Oracle which has to do with setting default values on a table's column.

In DB2:

. . mychar CHAR(8) NOT NULL WITH DEFAULT SESSION_USER, . .

I understand how to do things in oracle like setting the default value to a specific string, but I'm not sure if there is an Oracle equivalent to DB2 allowing you have the SESSION_USER be the default value.

Do I need to get creative with maybe triggers and stored procedures? Is there an easier way?

最满意答案

这在Oracle中也是如此。

Oracle语法几乎相同。 在Oracle中不使用关键字WITH ,只使用关键字DEFAULT 。 Oracle中的USER是USER而不是SESSION_USER 。

This works the same in Oracle.

The Oracle syntax is almost the same. You don't use the keyword WITH in Oracle, only the keyword DEFAULT. And the user in Oracle is USER rather than SESSION_USER.

更多推荐

本文发布于:2023-08-07 11:45:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1464151.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何将   默认值   Oracle   column   replicate

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!