Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / DB2 Topics / January 2005

Tip: Looking for answers? Try searching our database.

Issue with a stored procedure

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
James Foreman - 21 Jan 2005 16:21 GMT
[Running 8.2.0 on Suse 8.1]

I'm building a stored procedure that simulates cars arriving in a car
park, and staying for different amounts of time, based on historical
data.

So, first I define a cursor that's populated by querying last year's
bookings for the period that I'm interested in.  This is about 6,500
bookings.

The sp then looks at the first booking and compares it to how many cars
are already in the car park.  If adding that booking would violate the
maximum space in the car park, it excludes the booking.  Otherwise, it
increments the number of cars in the car park on the days of the
booking, and then cycles through to the next booking.

However, it fails to process more than 10 bookings before exiting with
status 0.  I couldn't understand what was going on, so I tried
modifying the procedure to add another input parameter.  This then
limits the query that populates the cursor to a single booking
reference.  I then tried running this sp for the next booking after the
last successful one in the first stored procedure.

This went in fine.  As did the booking after that, and the booking
after that.  I'd rather not run this sp 6,500 times, particularly as my
analysts want to use this stored procedure multiple times, against
different scenarios for space in the car park.  What should I be
looking for to diagnose the error here?  Could there be an issue with
the space available for the stored procedure, such that the cursor
can't read in all the rows?
Serge Rielau - 21 Jan 2005 16:43 GMT
> [Running 8.2.0 on Suse 8.1]
>
[quoted text clipped - 26 lines]
> the space available for the stored procedure, such that the cursor
> can't read in all the rows?

Looks more like an algorithmic problem. Did you use the debugger?
Maybe tracing would help to get to the bottom of this:
http://www-128.ibm.com/developerworks/db2/library/techarticle/dm-0409rielau/inde
x.html


Lastly, if you can, try FP8 (it's on the web now). There were a couple
of teething problems with the new SQL PL Virtual machine. Without
knowing your procs it's impossible to tell whether you may be affected
or not.

Cheers
Serge
Signature

Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab

James Foreman - 21 Jan 2005 17:17 GMT
Thanks.  We'll try tracing it and see what happens
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.