在立即执行中使用授予管理选项时如何解决错误

how to resolve error while using grant admin option in execute immediate

我正在尝试 运行 下面的脚本。我的脚本在 EXECUTE IMMEDIATE 中没有“WITH ADMIN OPTION”时工作正常。但是当使用“WITH ADMIN OPTION”时,出现以下错误。

"Error report - ORA-00900: invalid SQL statement ORA-06512: at line 17 00900. 00000 - "invalid SQL statement"".

SET SERVEROUTPUT ON;
DECLARE
    v_Model_UserName VARCHAR2(30) := UPPER('&Model_UserName');
    v_Cloned_UserName VARCHAR2(30) := UPPER('&Cloned_UserName');
    v_dba_role_privs VARCHAR2(3000); -- for dba_role_privs


    --- selecting the roles from model user (from dba_role_privs table)
    CURSOR c_role_privs (var01  Varchar2 )is
    SELECT granted_role from dba_role_privs where grantee = var01;

    BEGIN
--- granting the roles from model user to cloned user (from dba_role_privs table)  
    OPEN c_role_privs (v_Model_UserName);
    LOOP
    FETCH c_role_privs INTO v_dba_role_privs;
    EXIT WHEN c_role_privs%NOTFOUND;
    EXECUTE IMMEDIATE 'grant'||v_dba_role_privs||' to '||v_Cloned_UserName||' WITH ADMIN OPTION';
    END LOOP;
    CLOSE c_role_privs;
    END;
    /

尝试在 grant 关键字后添加 space:

EXECUTE IMMEDIATE 'grant '||v_dba_role_privs||' to '||v_Cloned_UserName||' WITH ADMIN OPTION';