473,773 Members | 2,326 Online
Bytes | Software Development & Data Engineering Community
+ 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 1478
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
22146
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 application server can talk to the database. I've determined the failure occurs when the the following statement is executed: cstmt.execute(); (due to the failure of println statements placed afterwards). I get the following error after trying to...
2
2001
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 overcome the slowness, they have installed a new server with SQL Server 2000 Enterprise Edition with 'Log Shipping' enabled (to provide a subsidiary database on which reports can be run) but although the speed issue is resolved, there are hitherto...
4
3191
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 Throwable as an OUT parameter and what datatype should I use in the CREATE PROCEDURE and DROP PROCEDURE statements? Here's what I tried: - the method signature for the stored procedure included: Throwable throwable
8
7944
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 created a temporary database with a tables space. Verified that DECLARE GLOBAL TEMPORARY TABLE TEMP (A INTEGER); INSERT INTO SESSION.TEMP VALUES(10); SELECT A FROM SESSION.TEMP; works from a query tool.
2
5459
by: Dino L. | last post by:
How can I run stored procedure (MSSQL) ?
3
1951
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 of my procedure identifies the # of fields necessary. That is working correctly. The second part of the procedure actually attempts to create the table. This is where my issue is. If I attempt to create the table as a non-temporary table,...
10
1838
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 lighting turnover from Indoor lighting'. /qbrowse/forms/New Starter Feedback Form.asp, line 65 where line 65 executed the following sql statement
2
2820
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 "smalldatetime" fields. In my class for this table, when inserting new or saving a row in the table, both of these date values may possibly be empty. (ie I am allowing nulls on the db side... )
3
1527
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 written in concatinated string format (provided below). when i execute the procedure on my clients database some concatinated lines in the select statement are not considered.(i.e the select statement is executed without those two line between the...
0
9454
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10264
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10106
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10039
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6717
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5355
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3610
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2852
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.