給自己做個備份。
這個簡單例子使用了記錄集,游標等簡單功能,正常返回ok,錯誤返回ng,同時在db端控制台輸出錯誤資訊。
create or replace package employee_import_sql as
--リテン結果
ret_ng constant varchar2(2) := 'ng';
ret_ok constant varchar2(2) := 'ok';
--社員グループ更新機能
function th_main return varchar2;
end employee_import_sql;
create or replace package body employee_import_sql as
type t_emp_group_member_rec is record (
r_empcode emp_group_member.employee_code%type,
r_groupcode emp_group_member.emp_group_code%type
);function th_main return varchar2 as
cursor emp_group_member_cursor is
select
emp_detail.employee_code,
depart_emp_group.emp_group_code
from
depart_emp_group,
emp_detail,
depart
where
emp_detail.depart_code = depart_emp_group.depart_code
anddepart.depart_code = depart_emp_group.depart_code
order by
depart_emp_group.emp_group_code,
emp_detail.employee_code;
seq_group_code number;
ncount number;
emp_group_member_rec t_emp_group_member_rec;
v_errorcode number;
v_errortext varchar2(200);
begin
ncount := 1;
delete
emp_group_member
where
emp_group_member.emp_group_code in
(select emp_group_code from depart_emp_group);
open emp_group_member_cursor;
loop
fetch emp_group_member_cursor into emp_group_member_rec;
exit when emp_group_member_cursor%notfound;
select seq_emp_group_member_code.nextval into seq_group_code from dual;
insert into emp_group_member
values(
seq_group_code,
emp_group_member_rec.r_empcode,
emp_group_member_rec.r_groupcode,
ncount
);ncount := ncount + 1;
end loop;
return ret_ok;
exception
when others then
v_errorcode:=sqlcode;
v_errortext:=substr(sqlerrm,1,200);
dbms_output.put_line(v_errorcode);
dbms_output.put_line(v_errortext);
return ret_ng;
end th_main;
end employee_import_sql;
/
乙個簡單的json例子
名稱 年齡郵箱 response.setcontenttype text html charset utf 8 response.setheader cache control no cache jsonobject json new jsonobject try json.put jobs mem...
乙個poll的簡單例子
該程式使用poll事件機制實現了乙個簡單的訊息回顯的功能,其伺服器端和客戶端的 如下所示 伺服器端 start from the very beginning,and to create greatness author chuangwei lin e mail 979951191 qq.com b...
KNN乙個簡單的例子
對未知類別屬性的資料集中的每個點依次執行以下操作 import numpy as np import operator def createdataset group np.array 1.0,1.1 1.0,1.0 0,0 0,0.1 labels a a b b return group,lab...