2017-04-21 150 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;