0

I have a stored procedure, in which I want to simply store result of a select statement in an output parameter and return that , how can i do that.

I would appreciate if you give me the right syntax of it, since i am new to DB and Sybase specially, that's why i am just giving u a pseudo code for that..

 /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

 }
user620339
  • 851
  • 3
  • 20
  • 42

2 Answers2

0

You don't need output parameters to return result of query, try below code

create procedure proc1
(
  @val1 integer
)
as
begin
  select * from emplyees
end
Robert
  • 25,425
  • 8
  • 67
  • 81
0

/pseudo code

create my_proc(in_param int,out_param1 int out,out_param2 int out)

BEGIN

.....other select and insert statements

if(xyz=true)BEGIN
select out_param1=e.col1,out_param1=2=e.col2 from emplyees e
END
END

Modify datatypes accordingly

Thanks, Gopal