Home > OS >  Unable to select data via read only transaction
Unable to select data via read only transaction

Time:11-02

I am using Oracle and SQL Developer. I have a table called T_TEST owned by SYSTEM (I know, that I shouldn't do it, but it's not a commercial project). I created another user and gave him this privileges:

GRANT CONNECT TO admin1;
GRANT CREATE SESSION TO admin1;
GRANT SELECT ON T_TEST TO admin1;

When I run this query I get the expected result:

SELECT SUM(value) FROM SYSTEM.T_TEST;

However, when I try to wrap this query in a transaction like this:

CREATE PROCEDURE reader
AS
BEGIN
    SET TRANSACTION READ ONLY;
    SELECT SUM(value) FROM SYSTEM.T_TEST;
    COMMIT;
END;

I get this error:

ORA-01031: insufficient privileges

So which privilege am I missing here?

CodePudding user response:

You are missing grants to create a procedure. You can do that by following the below command -

GRANT CREATE PROCEDURE TO [domain\user]

This link has a whole list of permissions that you can grant to the users. Enjoy your project.

  • Related