警告:编译但在oracle中有编译错误

时间:2017-04-21 13:13:53

标签: oracle plsql toad

我在蟾蜍得到这个警告。所以无法使用该程序。我先创建一个varray。

function expand(d){
    if(d._children){
        d.children = d._children;
        d.children.filter(function(d) { return d.name.indexOf("SpecialNode") > -1; })
                  .forEach(expand);
        d._children = null;
    }
}

然后我正在创建一个程序。

CREATE or replace  TYPE notif_array AS VARRAY(100000) OF VARCHAR2(10);

然后我收到蟾蜍的警告

CREATE OR REPLACE PROCEDURE get_notification_id
    ( personrole in varchar2, personid out notif_array )
is
begin
    DBMS_OUTPUT.PUT_LINE(personrole);

    select person_id into personid
    from   exp_role_person_mapping
    where  person_role = personrole;
exception
    when others then
        personid := null;
end;

2 个答案:

答案 0 :(得分:0)

您需要更改为personid分配数据的方式。

它不是基本数据类型,而是根据您的要求定义的自定义数据类型

CREATE OR REPLACE PROCEDURE get_notification_id(personrole in varchar2,personid out notif_array)
is
CURSOR cur_temp(per_role varchar2)
IS
   select person_id from  exp_role_person_mapping where person_role=per_role;
   index NUMBER := 1;
begin
   DBMS_OUTPUT.PUT_LINE(personrole);
   FOR datarecord in cur_temp(personrole)
   LOOP
       personid(index) := datarecord.person_id;
       index = index + 1;
   END LOOP;
exception when others then
   personid:=null;
end;

答案 1 :(得分:0)

只需添加"批量收集"在select语句中。感谢Ponder Stibbons

CREATE OR REPLACE PROCEDURE get_notification_id(personrole in varchar2,personid out notif_array)
is
begin
select person_id bulk collect  into personid from  exp_role_person_mapping where person_role=personrole;
exception when others then
personid:=null;
end;
相关问题