Oracle存储过程,以游标的方式返回一个记录集
--创建一个包
create or replace package types
as
type cursorType is ref cursor;
end types;
--创建存储过程,游标类型返回参数
create or replace procedure SP_Fee_Instance(v_company in varchar, v_sdate in nvarchar2, v_edate in nvarchar2,p_cursor in out types.cursorType) is
-- vs_sql varchar2(2000);
--company varchar2(100); --公司编码
--start_date varchar2(10); --计划付款时间段[起]
--end_date varchar2(10); --计划付款时间段[止]
begin
IF NVL(v_company,' ') <> ' ' THEN
OPEN p_cursor FOR
select a.company,a.pact_name,a.pact_code,i.payment_date,sum(i.payment_fee) as payment_fee,i.payment_condition,i.payment_remark
from htgl_pact_apply a
inner join htgl_fee_instance i on a.apply_id = i.apply_id
where a.payment_status=2
and a.company = v_company
and i.payment_date between to_date(v_sdate,'YYYY-MM-DD') and to_date(v_edate,'YYYY-MM-DD')
group by a.company,a.pact_name,a.pact_code,i.payment_date,i.payment_condition,i.payment_remark;
null;
-- dbms_output.put_line(company);
--
相关文档:
oracle表空间操作详解
1
2
3作者: 来源: 更新日期:2006-01-04
5
6
7建立表空间
8
9CREATE TABLESPACE data01
10DATAFILE '/ora ......
一、准备特殊数据
create table t_escape(s varchar2(50));
--show define -- define "&" (hex 26)
--show escape -- escape off
set define off
set escape on
insert into t_escape values('string&text');
insert into t_escape values('string\&text');
insert into t_escape values('st ......
1.求部门中哪些人薪水最高:
select ename,sal
from emp join
(
select max(sal) max_sal, deptno
from emp
group by deptno
) t
on (emp.sal = t.max_sal and emp.deptno = t.deptno);
2.求部门平均薪水的等级:
select deptno, avg_sal, grade ......
001、字符
length/lengthb 字符数(1个汉字1个字符) / 字节数(1个汉字2个字节)
ltrim/rtrim/trim 删除空格
lower/upper 大小写转换
select length('abc') from dual;
select substr(ename, 1, 3) from emp; 从第一个字符开始截,一共截3个字符
substr('abcdefg',2,3) => ......
Oracle 主要配置文件介绍:
profile文件,oratab 文件,数据库实例初始化文件 initSID.ora,监听配置文件, sqlnet.ora 文件,tnsnames.ora 文件
1.2 Oracle 主要配置文件介绍
1.2.1 /etc/profile 文件
系统级的环境变量一般在/etc/p ......