error: ORA-01031: insufficient privileges
error: ORA-01031: insufficient privileges
我有问题。
CREATE TABLE accounts(
id INTEGER,
name VARCHAR2(100)
)
/
CREATE OR REPLACE FUNCTION account_balance(account_id_in IN accounts.id%TYPE)
RETURN NUMBER
IS
BEGIN
RETURN 0;
END;
/
错误:
Error starting at line : 1 in command -
CREATE OR REPLACE FUNCTION account_balance(account_id_in IN accounts.id%TYPE)
RETURN NUMBER
IS
BEGIN
RETURN 0;
END;
Error report -
ORA-01031: insufficient privileges
01031. 00000 - "insufficient privileges"
*Cause: An attempt was made to perform a database operation without
the necessary privileges.
*Action: Ask your database administrator or designated security
administrator to grant you the necessary privileges
请帮我解决以上错误,谢谢!
正如评论中所指出的,您缺少从当前使用的任何用户帐户创建函数所需的权限。
让我们假设您的权限较低的登录名为 some_user
。要解决您的问题,请以您的更高权限帐户登录,然后应用以下 GRANT
语句:
grant create procedure to some_user;
文档:GRANT
CREATE PROCEDURE
: Create stored procedures, functions, and packages in the grantee's schema.
登录为
sys as sysdba
然后将用户名改成你的用户名后执行以下命令
GRANT CREATE PROCEDURE TO username;
我有问题。
CREATE TABLE accounts(
id INTEGER,
name VARCHAR2(100)
)
/
CREATE OR REPLACE FUNCTION account_balance(account_id_in IN accounts.id%TYPE)
RETURN NUMBER
IS
BEGIN
RETURN 0;
END;
/
错误:
Error starting at line : 1 in command -
CREATE OR REPLACE FUNCTION account_balance(account_id_in IN accounts.id%TYPE)
RETURN NUMBER
IS
BEGIN
RETURN 0;
END;
Error report -
ORA-01031: insufficient privileges
01031. 00000 - "insufficient privileges"
*Cause: An attempt was made to perform a database operation without
the necessary privileges.
*Action: Ask your database administrator or designated security
administrator to grant you the necessary privileges
请帮我解决以上错误,谢谢!
正如评论中所指出的,您缺少从当前使用的任何用户帐户创建函数所需的权限。
让我们假设您的权限较低的登录名为 some_user
。要解决您的问题,请以您的更高权限帐户登录,然后应用以下 GRANT
语句:
grant create procedure to some_user;
文档:GRANT
CREATE PROCEDURE
: Create stored procedures, functions, and packages in the grantee's schema.
登录为
sys as sysdba
然后将用户名改成你的用户名后执行以下命令
GRANT CREATE PROCEDURE TO username;