Click to See Complete Forum and Search --> : Privileges for PL/SQL ...


oracle_faq
08-17-2004, 07:17 PM
If I want to execute the following command in PL/SQL procedure:

'grant select, insert, update, delete on owner.table_name to public'

using execute immediate.

What kind of privileges does the USER executing the procedure needs.

Assuming the table owner is different than the user running the procedure.

Thanks in advance.

DevangP
08-18-2004, 10:01 AM
grant with admin options

oracle_faq
08-18-2004, 12:41 PM
What kind of privilege should it be?

example: grant select any table to user1 with admin option. ???

oracle_faq
08-18-2004, 01:01 PM
Found it. It is

grant GRANT ANY OBJECT PRIVILEGE to user1;

Thanks.

gandolf989
08-18-2004, 01:36 PM
Originally posted by oracle_faq
Found it. It is

grant GRANT ANY OBJECT PRIVILEGE to user1;

Thanks.

Thants like hanging up a picture with a sledge hammer.
You might not want to grant admin option to public.
Just grant execute on the procedure to the people who need it.


grant select, insert, update, delete
on owner.table_name to schema_owner with grant option;

oracle_faq
08-18-2004, 02:18 PM
The scenario I am trying to solve is as below.

1. Create a table in a procedure.
2. Grant insert update select delete on the table...within the same procedure.

Since I am creating the table in a different schema that the user who is executing the procedure...the procedure execution fails. So was looking for a privilege I need to give to the user to make it work. This user already has DBA privs. The only problem is that PL/SQL does not see these privs...so I have to grant them explicitly.

marist89
08-18-2004, 02:35 PM
create any table

gandolf989
08-18-2004, 02:40 PM
Originally posted by oracle_faq
The scenario I am trying to solve is as below.

1. Create a table in a procedure.
2. Grant insert update select delete on the table...within the same procedure.

Since I am creating the table in a different schema that the user who is executing the procedure...the procedure execution fails. So was looking for a privilege I need to give to the user to make it work. This user already has DBA privs. The only problem is that PL/SQL does not see these privs...so I have to grant them explicitly.

This privilege Should work.
GRANT create any table TO schema_owner;

It is probably best if you give out privileges that user need and no more.

stecal
08-18-2004, 02:42 PM
You may also want to consider the "Privileges granted via role are disabled inside stored procedures" limitation.