-- 添加分区,这里是指没有确定maxvalue分区的情况
alter table tbl_hwdz_rpt_mscerr add partition p20130507 values less than (to_date('20130507','yyyymmdd'));
-- 拆分分区,是指指定maxvalue值的分区表
alter table tbl_hwdz_rpt_mscerr
split partition PMAX at (TO_DATE(' 2013-5-9', 'YYYY-MM-DD'))
into (partition p20130508, partition PMAX);
MERGE INTO ta a USING tb b ON (a.aid = b.bid) WHEN MATCHED THEN UPDATE SET a.aname = b.bname,a.atype = b.btype;
MERGE INTO ta a USING tb b ON (a.aid = b.bid) WHEN NOT MATCHED THEN INSERT VALUES (b.bid, b.bname, b.btype);
-- 有游标做测试数据过程
create or replace procedure p_test(o_flag out number) is
a t_city_service%rowtype;
cursor cur_1 is
select * from t_city_service;
b T_ANALYSE_SERVICE%rowtype;
cursor cur_2 is
select * from T_ANALYSE_SERVICE;
ERRCODE INT; -- ORACLE 错误代码
ERRMSG VARCHAR2(200); -- ORACLE 错误描述
begin
for i in 1 .. 3 loop
for a in cur_1 loop
for b in cur_2 loop
insert into t_ccc
(id, city_code, city_desc, remark)
values
(a.id, a.city_code, a.city_desc, b.code);
end loop;
end loop;
end loop;
commit;
o_flag := 0;
exception
WHEN OTHERS THEN
o_flag := 1;
ERRCODE := SQLCODE;
ERRMSG := SUBSTR(SQLERRM, 1, 200);
dbms_output.put_line(ERRCODE);
dbms_output.put_line(ERRMSG);
end p_test;
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/12961536/viewspace-769550/
,如需转载,请注明出处,否则将追究法律责任。