日期:2014-05-16 浏览次数:20555 次
create or replace procedure update_core_id(message out varchar2) is
e_id member.id%type;
e_sql varchar2(1000);
cursor cs_id
is
select id from member s where s.core_id in(select t.core_id from member t group by t.core_id having count(t.core_id)>1);
begin
open cs_id;
loop
fetch cs_id into e_id;
exit when cs_id%Notfound;
e_sql:='update member s set s.core_id=(select max(core_id)+1 from member) where s.id='||e_id;
DBMS_OUTPUT.put_line(e_id);
execute immediate e_sql;
end loop;
commit;
message:='已经输出SQL语句,并执行了对应的SQL,请检查是否正确';
close cs_id;
Exception
when others then
message:='出现异常了';
rollback;
end update_core_id;
create or replace procedure GET_XS_KSQK(resultXS out sys_refcursor) is
begin
open resultXS for
select tl.zkzh,tl.xm,kscj from tblkaosheng tl
where tl.bmdwdm = '100' or tl.bmdwdm='130' or
tl.bmdwdm = '500' or tl.bmdwdm='830' or
tl.bmdwdm = '2920' or tl.bmdwdm='2490'
order by tl.bmdwdm,tl.zkzh;
end GET_XS_KSQK;
create or replace package ref_xs is
type ref_xs_cursor is ref cursor;
end ref_xs;
create or replace procedure GET_XS_KSQK_PACK(resultxs out ref_xs.ref_xs_cursor) is
begin
open resultxs for
select tl.zkzh,tl.xm,kscj from tblkaosheng tl
where tl.bmdwdm = '100' or tl.bmdwdm='130' or
tl.bmdwdm = '500' or tl.bmdwdm='830' or
tl.bmdwdm = '2920' or tl.bmdwdm='2490'
order by tl.bmdwdm,tl.zkzh;
end GET_XS_KSQK_PACK;