2017-04-21 145 views
0

我在蟾蜍中收到此警告。所以无法使用该程序。我正在创建一个varray。警告:已编译但在编译时出错oracle

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; 

那之后我得到蟾蜍

Warning: compiled but with compilation errors 
+0

查询'用户错误'视图以查看实际问题。 (不确定Toad是否支持'show errors'。) –

+0

@AlexPoole。试过。它显示“没有错误”。 –

+0

将光标移至过程并按F4,弹出窗口将打开并转至错误选项卡。 – user75ponic

回答

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; 
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;