Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 simple query err for out parameter

Author  Topic 

aakcse
Aged Yak Warrior

570 Posts

Posted - 2012-02-02 : 09:57:01
I have created the below sp in T-SQL sybase 15, when I am trying to execute it using unnamed block, I am not getting the out parameter value,


drop procedure sproc_emp1
create proc sproc_emp1 ( @in_emp_no int,
@o_ename varchar(10) output
)
as
begin
declare @v_ename varchar(10)
select @v_ename=ename from ora_syb_emp where empno=@in_emp_no
select @o_ename=@v_ename
select @o_ename
end


here I am able to print the sp's @o_ename, from the main sp, but I am not able to print from the below calling program "select @ocall_ename" it is printing null values


declare @ocall_ename varchar(10)
begin
exec sproc_emp1 1001, @ocall_ename
select @ocall_ename
end




-Neil

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-02-02 : 10:03:47
you should call it like below


declare @ocall_ename varchar(10)
begin
exec sproc_emp1 1001, @ocall_ename out
select @ocall_ename
end





------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

aakcse
Aged Yak Warrior

570 Posts

Posted - 2012-02-02 : 12:04:01
Thanks Visakh, you are right. Now it is working.

-Neil
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-02-02 : 12:09:39
I know that
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -