我必须从包p_name调用一个过程,但它会将错误标记为' NAME'必须声明
DECLARE
V V_NAME;
V1 VARCHAR2(30);
v_sql VARCHAR2(4000);
BEGIN
SELECT PROCEDURE_NAME BULK COLLECT INTO V from ALL_PROCEDURES
where OBJECT_NAME='p_name';
FOR I IN 1..V.COUNT LOOP
name:='p_name';
v_sql:='begin'||name||'.'||V(I)||';'||'END;';
EXECUTE IMMEDIATE v_sql;
END LOOP;
END;
答案 0 :(得分:0)
如果这是唯一的问题,它应该是这样的:
DECLARE
V V_NAME;
V1 VARCHAR2(30);
NAME VARCHAR2(7);
v_sql VARCHAR2(4000);
BEGIN
SELECT PROCEDURE_NAME BULK COLLECT INTO V from ALL_PROCEDURES where
lower(OBJECT_NAME)='p_name';
FOR I IN 1..V.COUNT LOOP
name:=' p_name';
v_sql:='begin'||name||'.'||V(I)||';'||'END;';
EXECUTE IMMEDIATE v_sql;
END LOOP;
END;