Grant语句未在Oracle中运行

时间:2018-08-15 14:32:23

标签: sql oracle plsql statements

我编写了此脚本来授予对源DB上的功能的执行权限,以便可以使用DBlink从另一个DB访问这些功能。脚本运行没有问题,但是我仍然无法访问这些功能。

my_q = or_q_if_truthfull(
    name__icontains=name,
    age=age,
    mobile__contains=phone,
    email__icontains=email
    address__icontains=address,
    city__icontains=city,
)

一旦我运行此脚本...

DECLARE 
FNC_STRNG VARCHAR2(4000);
CURSOR CUR IS 
    SELECT * FROM USER_OBJECTS
    WHERE OBJECT_TYPE = 'FUNCTION'; 
BEGIN 
    FOR I IN CUR LOOP 
        BEGIN
            FNC_STRNG := 'GRANT EXECUTE ON schema_name.' || I.OBJECT_NAME || ' TO 
                          DB_LNK'; 
            EXECUTE IMMEDIATE FNC_STRNG; 
        EXCEPTION 
            WHEN OTHERS THEN 
                NULL; 
        END;
    END LOOP; 
END;

然后,当我尝试使用此脚本访问功能时:

PL/SQL procedure successfully completed.

我收到此错误:

SELECT schema_name.func_name@db_link(param1, param2) FROM schema_name.table_name@db_link;

0 个答案:

没有答案