Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2002
    Posts
    86

    Unanswered: Stored Procedure-help-help

    I ran the following SP and I got the following error,I should tell I install c compiler and application dev client and run db2iupdt,
    should I have precompiler==>compiler==>link for this SP?
    please Advise, Thanks
    I issue :db2 -Td@ -vf spc.sqc
    BEGIN
    DECLARE v_rowId VARCHAR(50);
    DECLARE v_rowCount INT DEFAULT 1;
    DECLARE at_end INT DEFAULT 0;
    DECLARE not_found CONDITION FOR SQLSTATE '02000';

    DECLARE del_eim CURSOR WITH HOLD FOR
    SELECT
    COID
    FROM
    BT_TRIALTEST
    WHERE COID < BATCH
    FOR UPDATE;

    DECLARE CONTINUE HANDLER FOR not_found
    SET at_end = 1;

    OPEN del_eim;

    ins_loop:
    LOOP

    FETCH del_eim INTO
    v_rowId;

    set v_rowCount = v_rowCount + 1;

    IF at_end = 1 THEN
    LEAVE ins_loop;
    ELSEIF at_end <> 1 THEN

    DELETE FROM BT_TRIALTEST
    WHERE CURRENT OF del_eim;


    IF MOD(v_rowCount,1000) = 0 THEN
    COMMIT;
    END IF;

    SET at_end = 0;
    ITERATE ins_loop;
    END IF;/* FOR AT_END */
    END LOOP;
    CLOSE del_eim WITH RELEASE;
    END
    DB21034E The command was processed as an SQL statement because it was not a
    valid Command Line Processor command. During SQL processing it returned:
    SQL10013N The specified library "db2udp" could not be loaded. SQLSTATE=42724

  2. #2
    Join Date
    Jul 2002
    Posts
    86

    stored procedure-help-help

    sory, I ran the following SP:
    CREATE PROCEDURE DELETE_EIM_PROD_SHIP(IN BATCH INT)
    LANGUAGE SQL

    BEGIN
    DECLARE v_rowId VARCHAR(50);
    DECLARE v_rowCount INT DEFAULT 1;
    DECLARE at_end INT DEFAULT 0;
    DECLARE not_found CONDITION FOR SQLSTATE '02000';

    DECLARE del_eim CURSOR WITH HOLD FOR
    SELECT
    COID
    FROM
    BT_TRIALTEST
    WHERE COID < BATCH
    FOR UPDATE;

    DECLARE CONTINUE HANDLER FOR not_found
    SET at_end = 1;

    OPEN del_eim;

    ins_loop:
    LOOP

    FETCH del_eim INTO
    v_rowId;

    set v_rowCount = v_rowCount + 1;

    IF at_end = 1 THEN
    LEAVE ins_loop;
    ELSEIF at_end <> 1 THEN

    DELETE FROM BT_TRIALTEST
    WHERE CURRENT OF del_eim;


    IF MOD(v_rowCount,1000) = 0 THEN
    COMMIT;
    END IF;

    SET at_end = 0;
    ITERATE ins_loop;
    END IF;/* FOR AT_END */
    END LOOP;
    CLOSE del_eim WITH RELEASE;
    END@

Posting Permissions

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