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 ......
ORACLE
CREATE OR REPLACE FUNCTION SETSTATE(OLDVALUE VARCHAR2, POS NUMBER, SVALUE VARCHAR2)
RETURN VARCHAR2
IS
RETURN_VALUE VARCHAR2 (20);
LEN NUMBER(8);
I NUMBER(8);
TEMP_VALUE VARCHAR2(1);
BEGIN
LEN := LENGTH(OLDVALUE);
IF POS > ......
The following are number examples for the to_char function.
to_char(1210.73, '9999.9')
would return '1210.7'
to_char(1210.73, '9,999.99')
would return '1,210.73'
to_char(1210.73, '$9,999.00')
would return '$1,210.73'
to_char(21, '000099')
would return '000021'
The following is a list ......