I have a problem.
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:
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
Please help me resolve above error, thank you!
As pointed out in the comments, you are missing the required permissions to create the function from whatever user account you are currently using.
Let's assume your less privileged login is called some_user
. To fix your problem, login as your more privileged account, and apply the following GRANT
statement:
grant create procedure to some_user;
Documentation: GRANT
CREATE PROCEDURE
: Create stored procedures, functions, and packages in the grantee's schema.