473,486 Members | 2,427 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Issue with a stored procedure

[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?

Nov 12 '05 #1
2 1461
James Foreman wrote:
[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?

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/developerwork...lau/index.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
--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Nov 12 '05 #2
Thanks. We'll try tracing it and see what happens

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
22089
by: dinesh prasad | last post by:
I'm trying to use a servlet to process a form, then send that data to an SQL server stored procedure. I'm using the WebLogic 8 App. server. I am able to retrieve database information, so I know my...
2
1985
by: Edward | last post by:
SQL Server 2000 Enterprise Edition Access 2000 Front End One of our clients has recently been experiencing problems with an app that has run satisfactorily (though slowly) for some time. To...
4
3171
by: Rhino | last post by:
Is it possible for a Java Stored Procedure in DB2 V7.2 (Windows) to pass a Throwable back to the calling program as an OUT parameter? If yes, what datatype should I use when registering the...
8
7891
by: Thomasb | last post by:
With a background in MS SQL Server programming I'm used to temporary tables. Have just started to work with DB2 ver 7 on z/OS and stumbled into the concept of GLOBAL TEMPORARY TABLE. I have...
2
5434
by: Dino L. | last post by:
How can I run stored procedure (MSSQL) ?
3
1924
by: pinney.colton | last post by:
I would like to create a stored procedure which creates a temp table to store some XML. The # of fields of XML is dependent upon the contents of another table in the application, so the first part...
10
1814
by: John Peach | last post by:
not sure if this is the right place to ask but, when i run the following query in ASP i get the error Microsoft OLE DB Provider for SQL Server error '80040e14' Invalid column name '2 UK...
2
2809
by: Brad Pears | last post by:
I am working on a vb.net 2005 project using sql server 2000 as the backend . I am having a bit of problems with date variables... Here is the scenario... I have a table that includes a couple...
3
1518
by: Vish4u | last post by:
Hello Everyone, I have a encountered a strange issue with the execution of my stored procedure on clients machine. My stored procedure contains a cursor in which there is a select statement...
0
7100
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6964
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7126
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7175
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7330
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4865
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3070
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1378
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.