Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to provide Grants from stored procedure using EXECUTE IMMEDIATE stmt

Oracle_WalkerDec 23 2011 — edited Dec 23 2011
I have created table in PL/SQL stored procedure by using the below code
EXECUTE IMMEDIATE 'CREATE TABLE USER_STATS(ID NUMBER , ADDRESS VARCHAR2(1000), DOB DATE)';
Now i want to Grant SELECT on for a user
EXECUTE IMMEDIATE 'GRANT select on USER_STATS to User_Sch&&INDEX._Sel_Rol';
But i have got the below error

ORA-00911: invalid character
ORA-06512: at "User_Sch01.USER_PACK", line 7
ORA-06512: at line 2

Please guide me to give the Grant for the table using execute immediate statement.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 20 2012
Added on Dec 23 2011
11 comments
1,275 views