【问题标题】:Return a result set as output param in a sybase stored proc在 sybase 存储过程中返回结果集作为输出参数
【发布时间】:2013-09-09 01:11:29
【问题描述】:

我有一个存储过程,我想在其中简单地将 select 语句的结果存储在输出参数中并返回,我该怎么做。

如果你能给我正确的语法,我将不胜感激,因为我特别是 DB 和 Sybase 的新手,这就是为什么我只是给你一个伪代码..

 /pseudo code
 create my_proc(in_param i,out_param o1,out_param o2){

 .....other select and insert statements
 .....
 if(xyz=true){
  o1 = select * from emplyees
  }

  return o1,o2

 }

【问题讨论】:

    标签: stored-procedures cursor sybase resultset output-parameter


    【解决方案1】:

    你不需要输出参数来返回查询结果,试试下面的代码

    create procedure proc1
    (
      @val1 integer
    )
    as
    begin
      select * from emplyees
    end
    

    【讨论】:

      【解决方案2】:

      /伪代码

      创建 my_proc(in_param int,out_param1 int out,out_param2 int out)

      开始

      .....其他选择和插入语句

      如果(xyz=true)开始
      从员工e中选择out_param1=e.col1,out_param1=2=e.col2
      结束
      结束

      相应地修改数据类型

      谢谢, 戈帕尔

      【讨论】:

        猜你喜欢
        • 2018-07-28
        • 2019-07-12
        • 2012-09-18
        • 2019-11-08
        • 2023-04-06
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-05-22
        相关资源
        最近更新 更多