Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2007
    Posts
    2

    Unanswered: Error 1034 while creating a Stored Procedure

    Hi guys!

    I'm facing with the Error -1034C while trying to create Stored procedure on all databases that I have.

    --- Here is the Stored Procedure savend in the file createSQLproc.db2:

    CREATE PROCEDURE sales_status
    (IN quota INTEGER, OUT sql_state CHAR(5))
    DYNAMIC RESULT SETS 1
    LANGUAGE SQL
    BEGIN
    DECLARE SQLSTATE CHAR(5);
    DECLARE rs CURSOR WITH RETURN FOR
    SELECT sales_person, SUM(sales) AS total_sales
    FROM sales
    GROUP BY sales_person
    HAVING SUM(sales) > quota;
    OPEN rs;
    SET sql_state = SQLSTATE;
    END @

    --- here is the command I'm using:
    db2 -td@ -vf createSQLProc.db2

    --- Here is the 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:
    SQL1034C The database is damaged. All applications processing the database have been stopped. SQLSTATE=58031

    ----
    I also tried to create using the Development Center but I got the same error.

    Thanks in advance for any help

  2. #2
    Join Date
    Jul 2006
    Location
    Pune , India
    Posts
    433
    I think database is damaged bcoz of some other reason not related to this SP.
    Issue a RESTART DATABASE command to recover the database. If the
    RESTART command consistently fails, you may want to restore the
    database from a backup.
    Rahul Singh
    Certified DB2 9 DBA / Application Developer

  3. #3
    Join Date
    Apr 2007
    Posts
    2
    Hi Rahul!

    I issued the RESTART DATABASE command and the error still persists.
    Also I tried to create another SP on another database and I got the same error. Maybe something is wrong in my configurations.

    here is my configuration values:

    DB2_SQLROUTINE_COMPILER_PATH = "C:\Program Files\Microsoft Visual Studio 8\VC\bin\VCVARS32.BAT"

    DB2_SQLROUTINE_COMPILE_COMMAND = "COMMAND="cl -Od -W2 /TC -D_X86_=1 -I%DB2PATH%\include SQLROUTINE_FILENAME.c /link -dll -defQLROUTINE_FILENAME.def /outQLROUTINE_FILENAME.dll %DB2PATH%\lib\db2api.lib"

    thanks again!

  4. #4
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    Which version of DB2 are you using on which platform? Since V8.2, you don't need a C compiler any longer so I would recommend that you move to V8.2 or V9.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

Posting Permissions

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