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

Home Posts Topics Members FAQ

Result set from ADMIN_CMD

Hi!

I'm trying to use ADMIN_CMD procedure in my SQL procedure like this:
DROP PROCEDURE IMPORT_DATA#
CREATE PROCEDURE IMPORT_DATA()
SPECIFIC IMPORT_DATA
MODIFIES SQL DATA
NOT DETERMINISTIC
LANGUAGE SQL
BEGIN ATOMIC
DECLARE DATA_REPL_ON_STATUS VARCHAR(10);
DECLARE ROWS_READ INTEGER;
DECLARE ROWS_SKIPPED INTEGER;
DECLARE ROWS_INSERTED INTEGER;
DECLARE ROWS_UPDATED INTEGER;
DECLARE ROWS_REJECTED INTEGER;
DECLARE ROWS_COMMITTED INTEGER;
DECLARE MSG_RETRIEVAL VARCHAR(500);
DECLARE MSG_REMOVAL VARCHAR(500);
DECLARE result1 RESULT_SET_LOCATOR VARYING;

SELECT STATUS INTO DATA_REPL_ON_STATUS FROM PARAMS WHERE CODE
= 'DATA_REPL_ON' WITH UR;

IF (DATA_REPL_ON_STATUS = '0') THEN
UPDATE PARAMS SET STATUS = '1' WHERE CODE = 'DATA_REPL_ON';

CALL SYSPROC.ADMIN_CMD('IMPORT FROM /home/gregor/TABLE1.IXF OF IXF
MESSAGES ON SERVER INSERT_UPDATE INTO EMGSYS.TABLE1');
ASSOCIATE RESULT SET LOCATORS(result1) WITH PROCEDURE
SYSPROC.ADMIN_CMD;
ALLOCATE rsCur CURSOR FOR RESULT SET result1;
FETCH rsCur INTO ROWS_READ, ROWS_SKIPPED, ROWS_INSERTED,
ROWS_UPDATED, ROWS_REJECTED, ROWS_COMMITTED, MSG_RETRIEVAL, MSG_REMOVAL;

UPDATE PARAMS SET STATUS = '0' WHERE CODE = 'DATA_REPL_ON';
END IF;
END

When I run this I get:
SQL20397W Routine "SYSPROC.ADMIN_CMD" execution has completed, but at least
one error, "SQL3015", was encountered during the execution. More information
is available.

In db2diag.log I get:
SQL0774N The statement cannot be executed within an ATOMIC compound
SQL statement.

I must use BEGIN ATOMIC, because of the UPDATE against table PARAMS.
Any idea how to solve this ?

Best regards,
Kovi
--
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
| In A World Without Fences Who Needs Gates? |
| Experience Linux. |
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
Oct 26 '06 #1
2 6818
Gregor Kovac( wrote:
Hi!

I'm trying to use ADMIN_CMD procedure in my SQL procedure like this:
DROP PROCEDURE IMPORT_DATA#
CREATE PROCEDURE IMPORT_DATA()
SPECIFIC IMPORT_DATA
MODIFIES SQL DATA
NOT DETERMINISTIC
LANGUAGE SQL
BEGIN ATOMIC
DECLARE DATA_REPL_ON_STATUS VARCHAR(10);
DECLARE ROWS_READ INTEGER;
DECLARE ROWS_SKIPPED INTEGER;
DECLARE ROWS_INSERTED INTEGER;
DECLARE ROWS_UPDATED INTEGER;
DECLARE ROWS_REJECTED INTEGER;
DECLARE ROWS_COMMITTED INTEGER;
DECLARE MSG_RETRIEVAL VARCHAR(500);
DECLARE MSG_REMOVAL VARCHAR(500);
DECLARE result1 RESULT_SET_LOCATOR VARYING;

SELECT STATUS INTO DATA_REPL_ON_STATUS FROM PARAMS WHERE CODE
= 'DATA_REPL_ON' WITH UR;

IF (DATA_REPL_ON_STATUS = '0') THEN
UPDATE PARAMS SET STATUS = '1' WHERE CODE = 'DATA_REPL_ON';

CALL SYSPROC.ADMIN_CMD('IMPORT FROM /home/gregor/TABLE1.IXF OF IXF
MESSAGES ON SERVER INSERT_UPDATE INTO EMGSYS.TABLE1');
ASSOCIATE RESULT SET LOCATORS(result1) WITH PROCEDURE
SYSPROC.ADMIN_CMD;
ALLOCATE rsCur CURSOR FOR RESULT SET result1;
FETCH rsCur INTO ROWS_READ, ROWS_SKIPPED, ROWS_INSERTED,
ROWS_UPDATED, ROWS_REJECTED, ROWS_COMMITTED, MSG_RETRIEVAL, MSG_REMOVAL;

UPDATE PARAMS SET STATUS = '0' WHERE CODE = 'DATA_REPL_ON';
END IF;
END

When I run this I get:
SQL20397W Routine "SYSPROC.ADMIN_CMD" execution has completed, but at least
one error, "SQL3015", was encountered during the execution. More information
is available.

In db2diag.log I get:
SQL0774N The statement cannot be executed within an ATOMIC compound
SQL statement.

I must use BEGIN ATOMIC, because of the UPDATE against table PARAMS.
Any idea how to solve this ?
I suspect that IMPORT performs a COMMIT....
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

IOD Conference
http://www.ibm.com/software/data/ond...ness/conf2006/
Oct 26 '06 #2
Yes, it does. Since V8 if one does not use the COMMITCOUNT parm. in the
command, DB2 figures out a commit count of its own in the command.
HTH, Pierre.

--
Pierre Saint-Jacques
SES Consultants Inc.
514-737-4515
"Serge Rielau" <sr*****@ca.ibm.coma crit dans le message de news:
4q************@individual.net...
Gregor Kovac( wrote:
>Hi!

I'm trying to use ADMIN_CMD procedure in my SQL procedure like this:
DROP PROCEDURE IMPORT_DATA#
CREATE PROCEDURE IMPORT_DATA()
SPECIFIC IMPORT_DATA
MODIFIES SQL DATA
NOT DETERMINISTIC
LANGUAGE SQL
BEGIN ATOMIC
DECLARE DATA_REPL_ON_STATUS VARCHAR(10);
DECLARE ROWS_READ INTEGER;
DECLARE ROWS_SKIPPED INTEGER;
DECLARE ROWS_INSERTED INTEGER;
DECLARE ROWS_UPDATED INTEGER;
DECLARE ROWS_REJECTED INTEGER;
DECLARE ROWS_COMMITTED INTEGER;
DECLARE MSG_RETRIEVAL VARCHAR(500);
DECLARE MSG_REMOVAL VARCHAR(500);
DECLARE result1 RESULT_SET_LOCATOR VARYING; SELECT STATUS INTO
DATA_REPL_ON_STATUS FROM PARAMS WHERE CODE
= 'DATA_REPL_ON' WITH UR;

IF (DATA_REPL_ON_STATUS = '0') THEN
UPDATE PARAMS SET STATUS = '1' WHERE CODE = 'DATA_REPL_ON';
CALL SYSPROC.ADMIN_CMD('IMPORT FROM /home/gregor/TABLE1.IXF OF
IXF
MESSAGES ON SERVER INSERT_UPDATE INTO EMGSYS.TABLE1');
ASSOCIATE RESULT SET LOCATORS(result1) WITH PROCEDURE
SYSPROC.ADMIN_CMD;
ALLOCATE rsCur CURSOR FOR RESULT SET result1;
FETCH rsCur INTO ROWS_READ, ROWS_SKIPPED, ROWS_INSERTED,
ROWS_UPDATED, ROWS_REJECTED, ROWS_COMMITTED, MSG_RETRIEVAL, MSG_REMOVAL;
UPDATE PARAMS SET STATUS = '0' WHERE CODE = 'DATA_REPL_ON';
END IF;
END

When I run this I get:
SQL20397W Routine "SYSPROC.ADMIN_CMD" execution has completed, but at
least
one error, "SQL3015", was encountered during the execution. More
information
is available.

In db2diag.log I get:
SQL0774N The statement cannot be executed within an ATOMIC compound
SQL statement.

I must use BEGIN ATOMIC, because of the UPDATE against table PARAMS.
Any idea how to solve this ?
I suspect that IMPORT performs a COMMIT....
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

IOD Conference
http://www.ibm.com/software/data/ond...ness/conf2006/
Oct 26 '06 #3

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

Similar topics

6
by: jerrygarciuh | last post by:
Hi all, I am iterating through a result set to generate a second set of queries but no matter what I do I get the error Warning: mysql_num_rows(): supplied argument is not a valid MySQL result...
2
by: maceo | last post by:
I have a script that will print out the results of a table and make a calculation of a total of one of the columns. See example: <?php /* Database connection */...
4
by: Tao Wang | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, I am quite confused on a equation, as following: #include <iostream> int main(){ int i = 2;
3
by: chettiar | last post by:
I am trying to do the following from within a procedure. set vcsql = 'Call SYSPROC.ADMIN_CMD(' || '''load from /dev/null of del replace into bi.Provisioned_Spam''' || ')'; execute immediate...
1
by: Gregor Kovač | last post by:
Hi! I'm using procedure ADMIN_CMD to export/import tables into IXF files. Is there a way to tell what codepage EXPORT/IMPORT should use? Best regards, Kovi --...
0
by: kyma333 | last post by:
We're on AIX5.3/DB2 UDB 8.1 FP12. One of the production servers have ADMIN_CMD but not the other one. I'm new to stored procedures in V8. What would be the easiest way to copy it over?
1
by: jefftyzzer | last post by:
Friends: The (v9) documentation for invoking LOAD via the ADMIN_CMD SP has this to say: "Since all load processes (and all DB2 server processes, in general) are owned by the instance owner,...
2
by: joachim.c.mueller | last post by:
Hello, is it not possible to load data with admin_cmd into a table? This SP ended with SQL3304N The table does not exist.: CREATE PROCEDURE ADM_LOAD ( ) DYNAMIC RESULT SETS 1 -- SQL...
0
by: David Beardsley | last post by:
I'm trying to write a stored procedure that will terminate a load for a given table using the SYSPROC.ADMIN_CMD procedure. When I take the syntax that works using Quest: LOAD FROM '/dev/null'...
0
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
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...
1
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...
0
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
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
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
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...

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.