Reputation: 1839
I have a user that needs the grant option adding. I have tried the following command;
grant myrole to myuser with grant option
However I get the error;
Dynamic SQL Error SQL error code = -104 Token unknown - line 1, column 29 grant
I have also tried revoking the role and then granting the role again. But I get the same error.
I am only able to grant the role without the grant option. I have checked the manual for the correct syntax, but I cannot see what I am doing wrong.
Upvotes: 2
Views: 2707
Reputation: 2014
Granting privileges seems to allow the use of 'with grant option'
GRANT {
<privileges> ON [TABLE] {tablename | viewname}
| EXECUTE ON PROCEDURE procname
}
TO <grantee_list>
[WITH GRANT OPTION]} | [{GRANTED BY | AS} [USER] grantor];
but granting a role doesn't seem to allow 'with grant option'. It has the 'with admin option' which is why I presume the error occurred once it came across the word 'grant' rather than 'admin' after the word 'with'.
GRANT <role_granted>
TO <role_grantee_list> [WITH ADMIN OPTION]
[{GRANTED BY | AS} [USER] grantor]
Upvotes: 2
Reputation: 109262
The GRANT
clause with grant option
is only for privileges, not for roles. For roles you need to use with admin option
.
GRANT <role_granted>
TO <role_grantee_list> [WITH ADMIN OPTION]
[{GRANTED BY | AS} [USER] grantor]
The optional
WITH ADMIN OPTION
clause allows the users specified in the user list to grant the role[s] specified to other users.
Upvotes: 4