PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: "Louis Proyect" <lnp3 at columbia dot edu>
Subject: RE: Column headings question
Date: Oct 8 2009 4:53PM

Thanks for all the suggestions. I found some code on a very old query
here that worked for me:

http://www.peppler.org/archive/sybperl-l/1997/11/1123.html

$X->ct_execute("exec stored_procedure");

while(($rc = $X->ct_results($restype)) == CS_SUCCEED) {
    next if($restype == CS_CMD_DONE || $restype == CS_CMD_FAIL ||
            $restype == CS_CMD_SUCCEED);
    if(@names = $X->ct_col_names()) {
       foreach $row (@names)
       {@column_names[$cntr] = $row;
        $cntr++;}
    }
    while(@dat = $X->ct_fetch)
    {$cc_count = @dat;
     if ($cc_count > 1)
     {@results = @dat;}
    }
}

Next I will correlate @column_names and @results, which contains the
data.

I should have mentioned, btw, that I needed to do this because the
results from the stored procedure contains over 100 separate columns and
I did not want to hard-code them in the script.

If anybody has any suggestions about tightening the code, I'd appreciate
them.

I have been working in sybperl for over 15 years now and there are still
lots of things that I feel like a newbie on--like this.