警告:已编译,但oracle中存在编译错误
我在蟾蜍身上得到了这个警告。因此无法使用该程序。我先创建一个varray警告:已编译,但oracle中存在编译错误,oracle,plsql,toad,Oracle,Plsql,Toad,我在蟾蜍身上得到了这个警告。因此无法使用该程序。我先创建一个varray 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.P
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
您需要更改将数据分配给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;
只需在select语句中添加“批量收集”。多亏了Pounder 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;
查询
用户错误
视图以查看实际问题。(不确定蟾蜍是否支持显示错误)。@AlexPoole。尝试它显示“无错误”。将光标移到过程并按F4,弹出窗口将打开并转到错误选项卡。它是pl/sql ora-00932不一致的数据类型预期udt got char
。如果将选择人员id更改为…
更改为选择人员id批量收集到…
则过程编译完成。它说“PL/SQL:ORA-00932:不一致的数据类型:预期的UDT GET CHAR”