If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > stored procedure error

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-27-09, 03:15
oracle10gsingh oracle10gsingh is offline
Registered User
 
Join Date: Nov 2007
Posts: 72
stored procedure error

i am trying to write a stored procedure which is giving me an error .no rows arre inserted ..could you please help me with this
i am trying to use load utility to insert data ..i tried with declaring a cursor but it didnt worked

CREATE PROCEDURE DSEDW.P_DAILY_HISTORY_SAURABH(Var_RangeStartDate date, Var_RangeEndDate
date, Var_DwhInsertDate date , Var_DwhProcessId Integer)

SPECIFIC P_DAILY_HISTORY
LANGUAGE SQL
BEGIN

declare Var_InStatement1 varchar(1000); --
declare Var_InStatement varchar(1000); --

set Var_InStatement1 ='LOAD FROM ( select * from DSEDW.DAILY_ACCOUNT_ARNGMNT_DIMN ) OF CURSOR insert into DSEDW.DAILY_HIST_ACCOUNT_ARNGMNT_DIMN';



CALL SYSPROC.ADMIN_CMD (Var_InStatement1);--
Reply With Quote
  #2 (permalink)  
Old 01-27-09, 03:24
JAYANTA_DATTA JAYANTA_DATTA is offline
Registered User
 
Join Date: Oct 2004
Location: DELHI INDIA
Posts: 336
The following one works. It's an IBM recommended good example: Please check whether you can have your statement implemented the STATIC way rather than having it DYNAMICALLY:


CREATE PROCEDURE FECHNER.REMOTE_LOAD_FROM_CURSOR ()
SPECIFIC REMOTE_LOAD_FROM_CURSOR
LANGUAGE SQL
BEGIN

DELETE FROM FECHNER.SALES;--

CALL SYSPROC.ADMIN_CMD ('LOAD FROM (DATABASE SRCDB SELECT * FROM FECHNER.SALES) OF
CURSOR INSERT INTO FECHNER.SALES NONRECOVERABLE');--
END;
__________________

Jayanta Datta
DB2 UDB DBA
IBM India, Global Delivery
New Delhi
Reply With Quote
  #3 (permalink)  
Old 01-27-09, 03:37
oracle10gsingh oracle10gsingh is offline
Registered User
 
Join Date: Nov 2007
Posts: 72
thanks for input but why load from (database ...should come ?
Reply With Quote
  #4 (permalink)  
Old 01-27-09, 04:13
JAYANTA_DATTA JAYANTA_DATTA is offline
Registered User
 
Join Date: Oct 2004
Location: DELHI INDIA
Posts: 336
DATABASE is optional, to represent REMOTE DATABASE for some particular case. In your case, its not reqd, this is just an example which represnts the STATIC way of the doing the same instead of doing it DYNAMICALLY.
__________________

Jayanta Datta
DB2 UDB DBA
IBM India, Global Delivery
New Delhi
Reply With Quote
  #5 (permalink)  
Old 01-27-09, 05:36
oracle10gsingh oracle10gsingh is offline
Registered User
 
Join Date: Nov 2007
Posts: 72
thanks ,
it worked for me ....but i want to do exceptional handling for load say if load fails for any reason ....how do i resume it ..

thanks
Reply With Quote
  #6 (permalink)  
Old 01-27-09, 10:46
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
I don't think you can restart if you are using a cursor. But, if you are loading from a file, then you can do

RESTART INTO instead of REPLACE INTO or INSERT INTO

HTH

Sathyaram
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On