Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How can i grant an execute statment

I want to grant TRIGGERS, FUNCTIONS and PROCEDURES to a role. I have the code to do it with procedure but with triggers and functions it not work.

create role Level1;
grant execute any trigger to Level1;
grant execute any procedure to Level1;

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

User owns tables, functions and procedures. That user created a role and wanted to grant execute on various objects to the role.

  • for triggers, it doesn’t make sense – they fire upon certain action on the table they are created on. Therefore, you’d grant privileges on the table, not on the trigger

  • for functions and procedures, you’d grant execute privilege on exact functions and procedures (not for all of them in a single statement), e.g.

    grant execute on p_insert_student to level1;
    grant execute on f_average_marks  to level1;
    

What you posted (grant execute any procedure) is a system privilege; that’s kind of dangerous; are you sure you want to let level1 execute absolutely any procedure within the database?

Also, there’s no separate grant for functions; in this context, they are considered to be procedures so execute any procedure affects functions as well.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading