oracle 存储过程
CREATE OR REPLACE PROCEDURE test
AS
data1 VARCHAR2(100);
data2 VARCHAR2(100);
cursor mycursor is select "FName_L2" from "T_CSL_RptItem";
begin
open mycursor;
loop
fetch mycursor into data1;
exit when mycursor%notfound;
select "FFieldName" into data2 from "T_CSl_ItemFieldMapped" t1 inner join "T_CSL_RptItem" t2 on t1."FItemID"=t2."FID" and t2."FName_L2"='||data1||';
dbms_output.put_line(data2);
end loop;
close mycursor;
end;
存储过程创建成功,但是执行的时候就报ora 01403 no data found错误,
补充:应该是在 select "FFieldName" into data2 from "T_CSl_ItemFieldMapped" t1 inner join "T_CSL_RptItem" t2 on t1."FItemID"=t2."FID" and t2."FName_L2"='||data1||';
这里报错。哪位大侠帮忙解决解决呀!呵呵
------解决方案--------------------说明没有查询到数据,自然会报这个错误。
关键看你想如何处理这个错误
begin
select "FFieldName" into data2 from "T_CSl_ItemFieldMapped" t1 inner join "T_CSL_RptItem" t2 on t1."FItemID"=t2."FID" and t2."FName_L2"='
------解决方案--------------------
data1
------解决方案--------------------
';
exception
when NO_DATA_FOUND then
--这里写你的没有数据的处理情况。。。。
end;
我的异常网推荐解决方案:oracle存储过程,http://www.aiyiweb.com/oracle-develop/177537.html