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

    Exclamation Unanswered: Compiling Stored Procedure

    I have created a stored procedure in DB2 stored proced builder, and it compiles and works great. But My dbA on staging would like to compile it and put it on the staging box using the command line and not the stored procedure builder. (USING THE COMMAD LINE TO DO THIS IS A MUST) I am not aware of away to do this. I am application developer and have had no experiance with this. Also my dba does not know how to do this.

    It is a regulare stored procedure consisting of...
    CREATE PROCEDURE SAMPLE.STOREDPROC(IN VALUE0 varchar(15),
    IN VALUE1 smallint,
    )
    RESULT SETS 1
    LANGUAGE SQL
    ------------------------------------------------------------------------
    -- SQL Stored Procedure
    ------------------------------------------------------------------------
    P1: BEGIN
    -- Declare cursor 1
    DECLARE cursor1 CURSOR WITH RETURN FOR

    SELECT DISTINCT
    ITEM1,
    ITEM2,
    ITEM3,
    ITEM4,
    ITEM5,
    FROM
    TABLE1,
    TABLE2,
    TABLE3,
    WHERE
    TABLEVALUE = VALUE0,
    AND TABLEVALUE1 = VALUE1;

    -- leave cursor 1 open
    OPEN cursor1;
    END P1

    So how would i go about compiling this from the commad line. Any help would be greatly appreciated.

    LT

  2. #2
    Join Date
    Jul 2002
    Posts
    2
    you should be able to do this using the following command:

    db2 -td@ -vf myProc.sql

    where myProc.sql is the route to a file containing the procedure you wish to build. note that the terminating character for the procedure is "@" - therefore your source should contain the normal procedure definition with "@" following the last "end" statement. For more info take the above statement and search on google, you should find loads of examples.

Posting Permissions

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