如果要添加的列具有我创建的类型,是否可以添加带有 alter table 的列?



如果我添加的列具有我创建的类型,是否可以添加带有Alter表的列?

这是代码:

CREATE OR REPLACE TYPE istoric IS table OF number(6,2);  
ALTER TABLE studenti ADD (history istoric) NESTED TABLE history STORE AS lista_tab;

我得到错误:

ORA-01031:特权不足。

我已经尝试授予特权,但没有改变任何东西。

您的用户ID无权更改表。DBA应GRANT您的用户ID具有所需的权利:

grant alter on tablename to youruserid;

参考:Oracle Alter表不足特权

要了解有关Oracle中的特权的更多信息:https://docs.oracle.com/database/121/dbseg/authorization.htm#dbseg999869

您应该做什么 special 我在Oracle 11G XE数据库上进行了测试。显然,您只需要CREATE TABLECREATE TYPE特权。请看一下此演示:首先,作为特权用户,我正在创建一个全新的用户,授予其特权,然后在问题中做您的工作。工作正常。

SQL> create user vlad identified by sima
  2  default tablespace users
  3  quota unlimited on users;
User created.
SQL> grant create session, create table, create type to vlad;
Grant succeeded.
SQL> connect vlad/sima@xe
Connected.
Session altered.
SQL> create table studenti (id number);
Table created.
SQL> create type istoric is table of number(6, 2);
  2  /
Type created.
SQL> alter table studenti add (history istoric) nested table history store as lista_tab;
Table altered.
SQL>

那么,Table Studenti属于谁?你还是别人?如果后者,则是 - 您可能缺乏某些特权。

最新更新