oracle执行存储过程报错:ORA-12011

前端之家收集整理的这篇文章主要介绍了oracle执行存储过程报错:ORA-12011前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

执行定时任务时报错:@H_404_1@


@H_404_1@


@H_404_1@


不一定是权限问题,但肯定是存储过程执行的问题。
我的存储过程带参数,我用测试存储过程的代码放入了job的what值,eg:proc_update_tag_cor_id(v_cor=>:v_cor
v_tag=>:v_tag
);


执行时没有传入参数值,所以执行不通过。

修改存储过程后(存储过程内部参数可以定义在执行过程中),就可以了@H_404_1@

附:@H_404_1@

我的存储过程代码:@H_404_1@

原来的:@H_404_1@

create or replace procedure proc_update_tag_cor_id(
c_course out sys_refcursor,
v_tag_id in out edc_tag_course.id%type,
v_cor_id in out edc_course.id%type)
AUTHID CURRENT_USER
is
begin
--查询“最新上市”tag的id
select t.id into v_tag_id from edc_tag_course t where t.tag_name = '最新上市';

if v_tag_id is null then
dbms_output.put_line('“最新上市”标签不存在');
return;
else
dbms_output.put_line('“最新上市”tagId is: '|| v_tag_id);
end if ;
--删除关联的最新课程
delete from ( select * from edc_tag_course_id where tag_id= v_tag_id);
--打开游标,获得最新课程的结果集
open c_course for
select t.id from (select id from edc_course order by create_time desc ) t where rownum <=5;
--提取游标值
fetch c_course into v_cor_id;


while c_course %found loop
dbms_output.put_line('new courses id is: '|| v_cor_id);
insert into edc_tag_course_id values(sys_guid(),v_cor_id,v_tag_id);
fetch c_course into v_cor_id;
end loop;
--关闭游标
close c_course;
commit;
end proc_update_tag_cor_id;
@H_404_1@

现在的:@H_404_1@

create or replace procedure proc_update_tag_cor_id AUTHID CURRENT_USER is c_course sys_refcursor; v_tag_id edc_tag_course.id%type; v_cor_id edc_course.id%type; begin --查询“最新上市”tag的id select t.id into v_tag_id from edc_tag_course t where t.tag_name = '最新上市'; if v_tag_id is null then dbms_output.put_line('“最新上市”标签不存在'); return; else dbms_output.put_line('“最新上市”tagId is: '|| v_tag_id); end if ; --删除关联的最新课程 delete from ( select * from edc_tag_course_id where tag_id= v_tag_id); --打开游标,获得最新课程的结果集 open c_course for select t.id from (select id from edc_course order by create_time desc ) t where rownum <=5; --提取游标值 fetch c_course into v_cor_id; while c_course %found loop dbms_output.put_line('new courses id is: '|| v_cor_id); insert into edc_tag_course_id values(sys_guid(),v_tag_id); fetch c_course into v_cor_id; end loop; --关闭游标 close c_course; commit; end proc_update_tag_cor_id; @H_404_1@ 原文链接:https://www.f2er.com/oracle/208342.html

猜你在找的Oracle相关文章