CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
不看会后悔的Windows XP之经验谈 简单快捷DIY实用家庭影院
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  Oracle >  开发

如何给写一个传入查询条件返回结果集的存储过程,大家帮帮忙吧.

楼主nankaijinke(jinke)2005-08-19 08:39:34 在 Oracle / 开发 提问

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

相关问题

  • 请问如何能将查询条件(字符串)传入存储过程,而返回数据集的记录总数?(急)
  • ORACLE中存储过程怎样返回查询结果集?
  • 存储过程 查询返回统计数问题
  • 如何让存储过程返回一个值,不是查询结果?
  • 如果从存储过程的查询结果返回记录数
  • 存储过程返回的查询能否使用游标获得啊?谢谢!!
  • 求教带参数查询并返回结果集的存储过程写法?
  • [存储过程醒目]我有一个存储过程,如何把它返回的结果作为一个表查询????
  • 存储过程返回参数给存储过程?
  • ======超级查询(存储过程)==================

关键词

  • visa
  • start
  • code
  • cablocgrid
  • condition
  • cert
  • sum
  • sn
  • varchar2
  • place

得分解答快速导航

  • 帖主:nankaijinke
  • njhart2003

相关链接

  • Oracle类图书

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo