我正试图查看是否有可能将从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.
更多推荐
发布评论