Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2003
    Posts
    9

    Unanswered: Error in Compilation of SQL Stored Procedure

    Hi,
    I am trying to create a simple stored procedure. But I am hitting to a starnge problem.

    C:\temp>db2 -td@ -vf samp.sql
    CREATE PROCEDURE get_count(OUT counter INT)
    LANGUAGE SQL
    BEGIN
    DECLARE SQLSTATE CHAR(5);
    DECLARE v_id CHAR(1);
    DECLARE v_name VARCHAR(15);
    DECLARE v_counter SMALLINT DEFAULT 0;
    DECLARE at_end SMALLINT DEFAULT 0;

    DECLARE not_found
    CONDITION for SQLSTATE '02000';
    DECLARE c1 CURSOR FOR
    SELECT id, name
    FROM stores;
    DECLARE CONTINUE HANDLER for not_found
    SET at_end = 1;
    SET counter = 0;

    OPEN c1;
    fetch_loop:
    LOOP
    FETCH c1 INTO
    v_id, v_name;
    IF at_end <> 0 THEN LEAVE fetch_loop;
    END IF;
    SET v_counter = v_counter + 1;
    END LOOP fetch_loop;
    CLOSE c1;
    SET counter = v_counter;
    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:
    SQL0444N Routine "build_sqlroutine" (specific name "SQL040225135440430") is
    implemented with code in library or path "\db2udp", function
    "build_sqlroutine" which cannot be accessed. Reason code: "4".
    SQLSTATE=42724
    C:\temp>whereis vcvars32
    C:\MicrosoftVisualStudio\VC98\bin/vcvars32.bat



    I have included the path for Visual C++ compiler [vcvars32.bat]. Is there anything that I am missing? Can anybody help me in resolving this.
    Thanks in advance.

  2. #2
    Join Date
    May 2002
    Location
    General Deheza, Cba, Arg.
    Posts
    276

    Re: Error in Compilation of SQL Stored Procedure

    hi

    do you run the vcvars32.bat?

  3. #3
    Join Date
    Dec 2003
    Posts
    9

    Re: Error in Compilation of SQL Stored Procedure

    Originally posted by achiola
    hi

    do you run the vcvars32.bat?
    No. In one of the README documents, it says thatvcvars32 should be in path. Hence I included that in the path. But still I don't know what I am missing.
    thanks

  4. #4
    Join Date
    May 2002
    Location
    General Deheza, Cba, Arg.
    Posts
    276

    Re: Error in Compilation of SQL Stored Procedure

    run this .bat.
    this bat make environment varibales, for exp. the path of the C.

    and tell me.

  5. #5
    Join Date
    Dec 2003
    Posts
    9

    Re: Error in Compilation of SQL Stored Procedure

    Originally posted by achiola
    hi

    do you run the vcvars32.bat?
    No. In one of the README documents, it says thatvcvars32 should be in path. Hence I included that in the path. But still I don't know what I am missing.
    thanks

  6. #6
    Join Date
    Dec 2003
    Posts
    9
    No, the result is same.
    C:\temp>vcvars32
    Setting environment for using Microsoft Visual C++ tools.
    C:\temp>db2 -td@ -vf samp.sql
    CREATE PROCEDURE get_count(OUT counter INT)
    LANGUAGE SQL
    BEGIN
    DECLARE SQLSTATE CHAR(5);
    DECLARE v_id CHAR(1);
    DECLARE v_name VARCHAR(15);
    DECLARE v_counter SMALLINT DEFAULT 0;
    DECLARE at_end SMALLINT DEFAULT 0;

    DECLARE not_found
    CONDITION for SQLSTATE '02000';
    DECLARE c1 CURSOR FOR
    SELECT store_id, name
    FROM stores;
    DECLARE CONTINUE HANDLER for not_found
    SET at_end = 1;

    -- initialize OUT parameter
    SET counter = 0;

    OPEN c1;
    fetch_loop:
    LOOP
    FETCH c1 INTO
    v_id, v_name;
    IF at_end <> 0 THEN LEAVE fetch_loop;
    END IF;
    SET v_counter = v_counter + 1;
    END LOOP fetch_loop;
    CLOSE c1;
    SET counter = v_counter;
    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:
    SQL0444N Routine "build_sqlroutine" (specific name "SQL040226174241540") is
    implemented with code in library or path "\db2udp", function
    "build_sqlroutine" which cannot be accessed. Reason code: "4".
    SQLSTATE=42724

    It is complaining against build_routine. Any clues?
    Thanks

  7. #7
    Join Date
    May 2002
    Location
    General Deheza, Cba, Arg.
    Posts
    276
    ok test this command
    C:\temp>db2 -vf samp.sql

Posting Permissions

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