• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 707
  • Last Modified:

how to get return value and cursor using ct_results() for Store procedure

I am using Sybase 15.0 version on Windows operating system. From C++ code using Sybase Client library I am executing a stored procedure.  

Say this is my stored procedure that I am invoking.

create procedure abc
select name, sal from employee
return 1

I am using ct_results() to get the result type, For the stored procedures which are not returning any rows, Result type is coming as CS_STATUS_RESULT, but for stored procedures which are retuning me some result set eg. Mentioned abc stored procedure where select statement returns some rows, result type is always coming as CS_ROW_RESULT.

I went through the link http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.help.os_15.0.comlib/html/comlib/X31916.htm

After searching for ct_result, I found some sample code; I could not get much help from there.

Can anyone please let me know using Sybase client library, how I can get return value from a stored procedure returning some rows?
1 Solution
Jan FranekCommented:
I recommend you to look at http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.help.os_15.0.clcprgde/html/clcprgde/X49044.htm - there's quite detailed manual on handling results that you get from Sybase server.

Your procedure is returning 2 results - one is CS_ROW_RESULT, second CS_STATUS_RESULT. Basically you keep calling ct_results until you process all of results, that your command returned.

You may also want to look at sample code delivered with your Sybase Client - usually in %SYBASE/%SYBASE_OCS/sample - try firstapp.c

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now