您的位置:首页 > 数据库 > Oracle

oracle pl_sql 通过游标循环取数字的方法

2013-06-09 08:41 549 查看
declare
cursorois
selectdistinctto_char(report_date,'yyyymmdd')report_datefromMy_test_DAY_REPORTwherereport_date>=to_date(20130501,'yyyymmdd')orderby1;
riqio%rowtype;
begin
openo;
loopfetcho
intoriqi;
exitwheno%notfound;
dbms_output.put_line(riqi.report_date);
deletefromtmp_no_rijiewhererun_date=to_date(riqi.report_date,'yyyymmdd');
commit;
insertintotmp_no_rijie
selectt1.org_code,
t1.org_name,
t1.org_type_id,
t1.org_type_name,
t1.sup_org_code,
t2.org_name,
t1.usable,
to_date(riqi.report_date,'yyyymmdd')
fromsys_orgt1,(selectorg_name,org_codefromsys_org)t2
whereorg_type_id=18
andusable=1
andt1.sup_org_code=t2.org_code
andt1.org_codein(130002,
150002,
150057,
150059,
150058,
140023,
140001,
110001,
170006,
170002,
180003,
140024)
andt1.org_codenotin
(selectorg_code
fromMy_test_DAY_REPORT
WHEREreport_date=to_date(riqi.report_date,'yyyymmdd'));
commit;
endloop;

closeo;
end;
/
selectrun_dateas日期,org_codeas组织,org_nameas组织名,'未做日结'fromtmp_no_rijieorderby1;

oraclepl_sql通过游标循环取数字的方法
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: