在oracle利用游标取数据库的结果集应用实例:
SQL> create table test2(s1 varchar(10),s2 varchar2(10));
表已创建。
SQL> insert into test2 values('11','111');
已创建 1 行。
SQL> insert into test2 values('22','222');
已创建 1 行。
SQL> CREATE OR REPLACE PACKAGE test222 AS
2 TYPE t_cursor IS REF CURSOR;
3 procedure p_test1( p_dd in out t_cursor);
4 end;
5 /
程序包已创建。
SQL> CREATE OR REPLACE package body test222 AS
2 procedure p_test1(
3 p_dd in out t_cursor)
4 is
5 begin
6 open p_dd for select * from test2;
7 end;
8 end;
9 /
程序包主体已创建。
SQL> var ss refcursor
SQL> exec test222.p_test1(:ss);
PL/SQL 过程已成功完成。
SQL> print ss
S1 S2
---------- ----------
11 111
22 222
SQL>
相关文档:
--使用DBA创建两个用户
create user gubo identified by gubo;
create user gubo2 identified by gubo;
--给两个用户连接权限
grant create session to gubo;
grant create session to gubo2;
--给其中一个用户访问表空间的权限
grant unlimited tablespace to gubo;
--连接其中用户,创建表
--conn gubo
......
select ss.*,
sum(ss.aa) over (partition by ss.zsid order by ss.zsid) as fu,
sum(ss.bb) over (partition by ss.zsid order by ss.zsid) as zheng
from
(
select m.zsid,
sum(n.f0004_028n) ov ......
describe TABLE_NAME; --描述
----------------------------------------------------------------
create table as select XXXXXX
insert into TABLE_NAME (reac_1,reac_2.....) values(v1,v2)
insert into TABLE_NAME (select * from ..........)
update TABLE_NAME set reac_1=v1,.............. ......
一。job的运行频率设置
1.每天固定时间运行,比如早上8:10分钟:Trunc(Sysdate+1) + (8*60+10)/24*60
2.Toad中提供的:
每天:trunc(sysdate+1)
每周:trunc(sysdate+7)
每月:trunc(sysdate+30)
每个星期日:next_day(trunc(sysdate),'SUNDAY')
每天6点:trunc(sysdate+1)+6/24
半个小时:sysdate+30/1440
3.每个 ......