oracle存储过程如何输出结果集?
网上搜到说用游标实现,我写了如下存储过程,请大侠看看我怎么得不到结果呢?
初学者,不知存储过程写的是否正确,请大家说的详细点。
CREATE OR REPLACE PACKAGE P_SEARCH_ERROR_PACKAGE AS
TYPE OUT_CUR IS REF CURSOR;
end P_SEARCH_ERROR_PACKAGE;
create or replace procedure P_SEARCH_ERROR(v_CO_NBR in varchar2,
v_outmsg out P_SEARCH_ERROR_PACKAGE.OUT_CUR)
AS
begin
declare
v_cfs_co_nbr varchar2(20);
v_cfs_co_id varchar2(16);
oe_hand_flag char(1);
oe_err_info varchar2(2000);
oe_order_error_id number;
begin
open v_outmsg for select distinct cfs.co_nbr,
cfs.co_id,
oe.hand_flag,
oe.err_info,
oe.order_error_id
into v_cfs_co_nbr,v_cfs_co_id,oe_hand_flag,oe_err_info,oe_order_error_id
from sp.crm_for_sa cfs, sp.order_error oe
where cfs.co_id = oe.co_id
and cfs.co_id in (select co_id
from crm.cust_order co
where co.co_nbr = v_CO_NBR)
and oe.hand_flag = 'D';
open v_outmsg for select distinct cfs.co_nbr,
cfs.co_id,
oe.hand_flag,
oe.err_info,
oe.order_error_id
into v_cfs_co_nbr,v_cfs_co_id,oe_hand_flag,oe_err_info,oe_order_error_id
from sp.crm_for_sa cfs, sp.order_error oe
where cfs.order_id = oe.order_id
and cfs.co_nbr = v_CO_NBR
and oe.hand_flag = 'D';
open v_outmsg for select distinct co.co_nbr,
co.co_id,
oe.hand_flag,
oe.err_info,
oe.order_error_id
into v_cfs_co_nbr,v_cfs_co_id,oe_hand_flag,oe_err_info,oe_order_error_id
from crm.cust_order co, sp.order_error oe
where co.co_id = oe.co_id
and co.co_nbr =v_CO_NBR
and oe.hand_flag = 'D';
exception
WHEN OTHERS THEN
ROLLBACK;
end;
end;
初学者,不知存储过程写的是否正确,请大家说的详细点。
CREATE OR REPLACE PACKAGE P_SEARCH_ERROR_PACKAGE AS
TYPE OUT_CUR IS REF CURSOR;
end P_SEARCH_ERROR_PACKAGE;
create or replace procedure P_SEARCH_ERROR(v_CO_NBR in varchar2,
v_outmsg out P_SEARCH_ERROR_PACKAGE.OUT_CUR)
AS
begin
declare
v_cfs_co_nbr varchar2(20);
v_cfs_co_id varchar2(16);
oe_hand_flag char(1);
oe_err_info varchar2(2000);
oe_order_error_id number;
begin
open v_outmsg for select distinct cfs.co_nbr,
cfs.co_id,
oe.hand_flag,
oe.err_info,
oe.order_error_id
into v_cfs_co_nbr,v_cfs_co_id,oe_hand_flag,oe_err_info,oe_order_error_id
from sp.crm_for_sa cfs, sp.order_error oe
where cfs.co_id = oe.co_id
and cfs.co_id in (select co_id
from crm.cust_order co
where co.co_nbr = v_CO_NBR)
and oe.hand_flag = 'D';
open v_outmsg for select distinct cfs.co_nbr,
cfs.co_id,
oe.hand_flag,
oe.err_info,
oe.order_error_id
into v_cfs_co_nbr,v_cfs_co_id,oe_hand_flag,oe_err_info,oe_order_error_id
from sp.crm_for_sa cfs, sp.order_error oe
where cfs.order_id = oe.order_id
and cfs.co_nbr = v_CO_NBR
and oe.hand_flag = 'D';
open v_outmsg for select distinct co.co_nbr,
co.co_id,
oe.hand_flag,
oe.err_info,
oe.order_error_id
into v_cfs_co_nbr,v_cfs_co_id,oe_hand_flag,oe_err_info,oe_order_error_id
from crm.cust_order co, sp.order_error oe
where co.co_id = oe.co_id
and co.co_nbr =v_CO_NBR
and oe.hand_flag = 'D';
exception
WHEN OTHERS THEN
ROLLBACK;
end;
end;
...全文
相关推荐
CallableStatement调用Oracle存储过程返回结果集(ResultSet).doc
CallableStatement调用Oracle存储过程返回结果集(ResultSet).doc
oracle存储过程学习实例文档 创建调用
oracle存储过程创建 游标的使用等等 java调用存储过程
CallableStatement调用Oracle存储过程返回结果集(ResultSet).docx
。。。
如何实现Java对Oracle存储过程的调用.pdf
如何实现Java对Oracle存储过程的调用.pdf
Oracle 存储过程JAVA调用存储过程 游标使用
NULL 博文链接:https://xiaohewoai.iteye.com/blog/523079


