Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2006
    Posts
    6

    Unanswered: procedure creation from db2cmd

    hi iam trying to create a simple stored procedure , but i want to do this by not using development centre. iam trying to create it from db2cmd , how do i go about it ,here is the procedure which iam trying to implement.


    CREATE PROCEDURE SHIBSD01.FOR_TEST
    (IN INPUT_VAR INTEGER,OUT OUTPUT_VAR INTEGER)
    P1:BEGIN
    SET OUTPUT_VAR = INPUT_VAR + 10;
    END P1
    ;

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Use you favorite text editor and put the create statement into a file like this:
    (note the @ sign is the create statement delimiter. you cannot use ; because it is needed inside the procedure body)

    CREATE PROCEDURE SHIBSD01.FOR_TEST
    (IN INPUT_VAR INTEGER,OUT OUTPUT_VAR INTEGER)
    P1:BEGIN
    SET OUTPUT_VAR = INPUT_VAR + 10;
    END P1
    @

    Save the file. Then from the command window:

    db2 connect to mydb user myuser using mypassword
    db2 -td@ -svf filename

    Note: you can put multiple statements into the file if you want to.

    HTH
    Andy

Posting Permissions

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