[python-sybase] stored procedure

Dave Cole djc at object-craft.com.au
23 Mar 2002 16:25:26 +1100


> Hi listers, I am trying to call a stored procedure using module v2.0
> on Sybase version 11.9.2.  The problem is that not all the records I
> am querying for using the stored procedure are returned in the
> result set.  Below is a snippet of my code:
> 
> #
> #Call stored procedure to get MO notification list(based on outage type)
> #
> db=Sybase.connect("<server>","<uname>","<pass>#",auto_commit=1)
> c=db.cursor()
> c.callproc('sp_get_mo_notification_list',tkt)
> c.nextset()
> 
> r=c.fetchall()
> 
> print "NTFY LIST: " +str(r)
> 
> Is there anything else I should be doing in order to fetch all the
> records I need?  Any help is greatly appreciated.

The first call to nextset() is going to be discarding a set of rows I
think.

Can you try doing this:

c.callproc('sp_get_mo_notification_list',tkt)
while 1:
    r=c.fetchall()
    print "NTFY LIST: " +str(r)
    if not c.nextset():
        break

- Dave

-- 
http://www.object-craft.com.au