473,324 Members | 2,239 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Db2 get diagnostic does not returns # of rows

I am trying to use GET DIAGNOSTICS statement after an DELETE IN DB2
does not return the # of rows inserted. Below is the code and output
It only returns the # on rows while debugging with datastudio, but not when invoked in command line
here is the proc (DB2 V9.1 FP 9 )


DROP PROCEDURE DB2RPDI.PURGE_STATS/
CREATE PROCEDURE DB2RPDI.PURGE_STATS
(IN DATE_PURGE DATE,
IN PCOMMIT BIGINT,
OUT DEL_HIST INTEGER,
OUT DEL_INF INTEGER,
OUT CPT_DEL INTEGER
)
LANGUAGE SQL
SPECIFIC ALIM_DERNIER_ENL
MODIFIES SQL DATA
BEGIN
DECLARE SQLSTATE CHAR(5);
DECLARE SQLCODE INTEGER;
DECLARE SQL_CODE INTEGER;
DECLARE SQL_CODE_C0 INTEGER;
DECLARE CPT BIGINT;
DECLARE DEL_HIST INTEGER;
DECLARE DEL_INF INTEGER;
DECLARE DEL_HIST_1 INTEGER;
DECLARE DEL_INF_1 INTEGER;
DECLARE W_OBJ_KEY INTEGER;
DECLARE W_OBJ_STAT INTEGER;
DECLARE C0 CURSOR WITH HOLD FOR SELECT OBJECT_KEY FROM DB2RPDI.AL_STATISTICS WHERE OBJECT_KEY > -1 and OBJECT_KEY < W_OBJ_KEY ;
SET DEL_HIST_1 = 0;
SET DEL_HIST = 0;
SET DEL_INF_1 = 0;
SET DEL_INF = 0;
DELETE FROM DB2RPDI.AL_HISTORY WHERE date(START_TIME) < DATE_PURGE;
GET DIAGNOSTICS DEL_HIST_1 = ROW_COUNT;
SET DEL_HIST = DEL_HIST_1;
COMMIT;
SELECT MIN(OBJECT_KEY) INTO W_OBJ_KEY FROM DB2RPDI.AL_HISTORY WHERE OBJECT_KEY > -1;
DELETE FROM DB2RPDI.AL_HISTORY_INFO WHERE OBJECT_KEY < W_OBJ_KEY AND OBJECT_KEY > -1 ;
GET DIAGNOSTICS DEL_INF_1 = ROW_COUNT;
SET DEL_INF = DEL_INF_1;
COMMIT;
....

Here is the output
Value of output parameters
--------------------------
Parameter Name : DEL_HIST
Parameter Value : -

Parameter Name : DEL_INF
Parameter Value : -


Return Status = 0

The # of rows is never null...
Thanks for help

Eric
Jan 25 '12 #1
0 1458

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: robert | last post by:
running 8.1.7 server, 8.1.6 client. i *thought* inner join should not return nulls, but not only that, but i get way more rows than i'm expecting. assume: order table: order_number
1
by: Sunny | last post by:
Hi, I have created DataSet and DataTable. I want to be able to locate a row in that table by looking for a particular value in a field. Lets say I have Field1, Field2 and Field3. Sometimes I need...
18
by: Daniel Billingsley | last post by:
Or seem to anyway. ===== string abc; if ((abc=getString()) != "") { MessageBox.Show(abc); } private string getString() {
2
by: Vagabond Software | last post by:
I'm at a complete loss on this problem. I'm using a DataColumn Expression with the DataTable Select method to return rows matching a data. Rows are returned on my Windows XP Professional computer...
7
by: serge | last post by:
How can I run a single SP by asking multiple sales question either by using the logical operator AND for all the questions; or using the logical operator OR for all the questions. So it's always...
1
by: damezumari | last post by:
I have a stored procedure: CREATE PROCEDURE jan.faq_mainframe (@type varchar(100)) as SELECT faq.id, faq.question, faq.answer, faq.faqtimestamp, faq.type
0
by: Jason James | last post by:
Hi, I would like to do this: Dim r As GridViewRow Dim nTotal As Single = 0 For Each r In GridView1.Rows If IsNumeric(r.Cells(2)) Then nTotal += CType(r.Cells(2).Text, Single) End If
1
by: paddymullaney | last post by:
Hi I have a query that is performing very strangely. I f I put a top statement in it returns rows, so Select top 10 * from .......
3
by: cookjean | last post by:
I have created a fairly complex view based upon several UNION statements and the view selects exactly the rows that I want if I am in ORACLE SQLPLUS or MS Access. But in Crystal Reports it returns...
1
itiger
by: itiger | last post by:
SELECT last_name, TO_CHAR(hire_date, 'DD-Mon-yyyy') from employees WHERE TO_DATE(hire_date, 'DD-Mon-YYYY') < '01-Jan-1990'; Output: LAST_NAME TO_CHAR(HIRE_DATE,'DD-MON-YYYY')...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.