Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: "Lee Falkenhagen" <falkenl at HOTMAIL dot COM>
Subject: getting results from select in an associative array
Date: Jul 23 1998 4:28PM

I am executing a stored procedure that executes as its last statement a 
select statement.  When in WISQL, the sp returns the rows in order.  
However, with the following code, it returns the rows a different order.  
I can not figure out what order it returns it in.

I need to keep the results in the same order because I am creating a 
flat file to load on a mainframe.  I need to have the key, because, 
later in the loop, I do not want to print certain columns.

Anyone know how to get the columns in the order of the select?

        $::dbh->dbcmd("exec proc_oi_case ");
        if ($::dbh->DBROWS ne FAIL) {
        $dbh1 = Sybase::DBlib->dbopen();
        open(OUTPUT, ">".$::SOURCEDIR."");
        $l_datacount = 0;
        while (%data = $::dbh->dbnextrow(1)) {
                while (($key,$value) = each %data) {
                        print "key = $key \n";
                        print OUTPUT "$value";

Get Your Private, Free Email at