如何给写一个传入查询条件返回结果集的存储过程,大家帮帮忙吧.
create or replace procedure P_CabLocGrid (v_start in number,v_sum in number,condition in varchar2,v_result out sys_refcursor)
is
begin
if condition is not null and condition<>'' then
execute immediate 'open v_result for select distinct substr(PLACE_SN,v_start,v_sum) from T_BLANK_CERT_VISA where AREA_CODE=' || condition ;
end if ;
end P_CabLocGrid;
***************************************************************************
execute immediate 'open v_result for select distinct substr(PLACE_SN,v_start,v_sum) from T_BLANK_CERT_VISA where AREA_CODE=' || condition ;
而且上面这句话要加一个varchar2的字符串,如果加入这个条件呢,
问题点数:20、回复次数:1Top
1 楼njhart2003()回复于 2005-08-19 08:43:31 得分 20
create or replace procedure P_CabLocGrid (v_start in number,v_sum in number,condition in varchar2,v_result out sys_refcursor)
is
begin
if condition is not null and condition<>'' then
open v_result for 'select distinct substr(PLACE_SN,v_start,v_sum) from T_BLANK_CERT_VISA where AREA_CODE=:v1 and xxxx=:v2 and ...' using condition,condition ... ;
end if ;
end P_CabLocGrid;
Top




