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!

DUAL Table problem

WilhelmSep 12 2007 — edited Sep 12 2007
As a quick way to grant privileges to almost all the objects in my schema to a role, i created a procedure (Courtesy of user CD from Oracle Forums). But when i executed the below mentioned procedure i got the error :

ORA-01720: grant option does not exist for 'SYS.DUAL'

To avoid granting privileges to sys.dual, I tried adding AND OBJECT_NAME < > 'SYS.DUAL' and AND OBJECT_NAME < > 'DUAL' to the query. But that this didn't help.

But when i query SELECT * FROM DUAL; i can see that DUAL table exists in my schema.

Any thoughts?

Here is what i did

CREATE ROLE newrole;

DECLARE
v_sql VARCHAR2(4000);
BEGIN
FOR obj IN (SELECT object_name
, object_type
, DECODE (OBJECT_TYPE,
'PROCEDURE','EXECUTE',
'FUNCTION' ,'EXECUTE',
'PACKAGE' ,'EXECUTE',
'SYNONYM' ,'SELECT' ,
'SEQUENCE' ,'SELECT' ,
'MATERIALIZED VIEW','SELECT',
'SELECT, INSERT, UPDATE, DELETE') rights
FROM user_objects where object_type IN
('FUNCTION','PROCEDURE','PACKAGE','SYNONYM','SEQUENCE','MATERIALIZED VIEW','TABLE','VIEW'))
LOOP
v_sql := 'GRANT ' || obj.rights || ' ON ' || obj.object_name || ' TO NEWROLE';
dbms_output.put_line(v_sql);
EXECUTE IMMEDIATE v_sql;
END LOOP;
END;
/
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 10 2007
Added on Sep 12 2007
17 comments
5,680 views