473,735 Members | 1,935 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calling SYSPROC.DB2LOAD within SQL stored procedure


How can one call SYSPROC.DB2LOAD procedure within a SQL stored
I get the following error:

DB21034E The command was processed as an SQL statement because it was
not a valid Command Line Processor command. During SQL processing it
returned: SQL0418N A statement contains a use of a parameter marker
that is not valid. LINE NUMBER=48. SQLSTATE=42610.

Thanks for your help.

The code is given below:

create procedure prod.cursorload (out p_status varchar(300))
language sql
specific prod.cursorload 0
modifies sql data

-- compound statements begin here
cs_0: begin

-- variable declaration
declare v_return integer default -1;
declare v_statusmsg varchar(300) default 'Procedure Error Terminated';
declare v_sqlstate char(5) default '00000';
declare sqlstate char(5) default '00000';

-- handler declaration
cs_0_0: begin
declare continue handler for not found
set v_sqlstate = '00000';
declare exit handler for sqlexception, sqlwarning
set v_sqlstate = sqlstate;
set p_status = v_sqlstate || ' ' || v_sp_name || ' ' ||

-- Load table

CALL sysproc.db2load ( 1, 'declare cur cursor for SELECT * from
'load from cur of cursor modified by norowwarnings insert into
prod.tableA nonrecoverable ',
?, '', ?, ?, ?, ?, ?, ?, ?, ?, ?, NULL) ;

set v_return = 0;
set p_status = v_sqlstate || ' ' || v_sp_name || ' Normal

end cs_0_0;
return v_return;
end cs_0

Apr 7 '06 #1
1 8263
I got the stored procedure compiled by doing the following:

-- Load variable declaration
declare v_version_numbe r INTEGER default 1;
declare v_cursor_statem ent VARCHAR(32672);
declare v_load_command VARCHAR(32672);
declare v_sqlcode INTEGER default -1;
declare v_sqlmessage VARCHAR(2048) default '';
declare v_rows_read BIGINT default -1 ;
declare v_rows_skipped BIGINT default -1;
declare v_rows_loaded BIGINT default -1;
declare v_rows_rejected BIGINT default -1;
declare v_rows_deleted BIGINT default -1;
declare v_rows_committe d BIGINT default -1;
declare v_rows_part_rea d BIGINT default -1;
declare v_rows_part_rej ected BIGINT default -1;
declare v_rows_part_par titioned BIGINT default -1;
declare v_mpp_load_summ ary VARCHAR(32672) default NULL;
CALL sysproc.db2load ( v_version_numbe r, 'declare cur cursor
for SELECT * from QA.tableA',
'load from cur of cursor modified by norowwarnings insert into
PROD.tableA nonrecoverable ',
v_sqlcode, v_sqlmessage, v_rows_read, v_rows_skipped,
v_rows_loaded, v_rows_rejected , v_rows_deleted, v_rows_committe d,
v_rows_part_rea d, v_rows_part_rej ected,
v_rows_part_par titioned, v_mpp_load_summ ary) ;

Is this the correct and only way todo it ?



Apr 7 '06 #2

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

Similar topics

by: Bas | last post by:
Hi, Using SQL 2k SP3 I want to know if there's a way to retrieve the name of the database a stored proc is run in. For example: CREATE PROCEDURE HelloWorld AS
by: mhk | last post by:
Hi, i have "req_date" column of "datetime" type in Database table besides other columns. From my Web page, i am calling the Stored Procedure with variable parameter "Search_Date" of Varchar(60) type. the value, i am passing to Stored procedure through "Search_Date" is compared to req_date column of table.
by: AS400 Guru | last post by:
I have this stored procedure that loops through a table and updates a couple of fields. For some reason one of the fields is not being updated. If I run the same code from query analyzer, it works fine. Let me know if anyone can figure out why @lastscandate would ever be NULL. If it is null it should be equal to @maildate. The senerio that seems to fail is when no records are returned from the select statement to fill in @lastscandate....
by: David Carver | last post by:
We are running into a problem with a Communication Link failure when calling an External Stored procedure written in ILE Cobol from an SQL UDF. When calling the stored procedure by itself and not within the UDF it runs fine, it's only when we excute the UDF that we get the communication link failure. I have setup EXTERNAL ACTION on the the UDF, the COBOL program doesn't execute any SQL statements. Here is the function and how it is...
by: Rajat Katyal | last post by:
Hi: I prepare the statement for execution as follows: PREPARE query(text) as SELECT count(*) FROM transform_customer_billing where inv_no = $1; The problem is Iam not able to execute this prepare statement from the stored procedure defined. I added the statement to call the prepare statement is: EXECUTE query('100023'). The ERROR it prints : Function query(text) doesnot exist. Please suggest the solution for this problem.
by: harborboy76 | last post by:
I am calling the exact same stored procedure called myprocedure from 2 different boxes from the CLP, but I'm experiencing different behaviors between them. After I was unable to get any support from IBM due to V7.1 being no longer supported, I figure someone here might be able to help. Is DB2 V7 more forgiving in the way I can call my stored procedure ? If it's defined with CHARACTER as incoming parameter, am I not required to put any...
by: ab | last post by:
In my ASP page I'm calling a Stored Procedure on my SQL Server. No problem. But I want to check if my SP returned an error (and what kind of error) instead of the required result. To call the SP I'm using the code on http://support.microsoft.com/kb/q164485 All hints are appreciated.
by: byahne | last post by:
We just went live today with a production SQL Server 2005 database running with our custom Java application. We are utilizing the jTDS open source driver. We migrated our existing application which was using InterBase over to SQL Server. To minimize the impact to our code, we created a stored procedure which would allow us to manage our primary key IDs (mimicing the InterBase Generator construct). Now that we have 150+ users in the...
by: adukuri | last post by:
Hi, I am new to jsp coding and I need some help in coding. 1. Writing to a text file from a result set. need to open a new txt file on a unix box and store it. 2. Paging. To generate mulitple -pages based on the records. 3. passing an resultset as an input to a oracle procedure.
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,...
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...
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,...
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
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();...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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.