Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2007
    Posts
    72

    Unanswered: 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);--

  2. #2
    Join Date
    Oct 2004
    Location
    DELHI INDIA
    Posts
    338
    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

  3. #3
    Join Date
    Nov 2007
    Posts
    72
    thanks for input but why load from (database ...should come ?

  4. #4
    Join Date
    Oct 2004
    Location
    DELHI INDIA
    Posts
    338
    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

  5. #5
    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

  6. #6
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •