Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2002
    Location
    CALIFORNIA
    Posts
    5

    Unanswered: Stored Procedure ?

    HI ,

    I have create a stored procedure as follows in db2:

    create procedure proc_name()
    language sql
    begin
    declare var1 integer;
    select column1 into var1 from table where column2=value;
    end;

    In db2 how do i print the value in var1/or know what the value stored in var1. do i need to use OUT parameter, if yes please suggest me how to use it.

    I appreciate if you could point me to some links where i can learn more about DB2 stored procedure in particular using select statements.

  2. #2
    Join Date
    Oct 2001
    Location
    Bangalore
    Posts
    186
    Hi,

    You guessed it correctly.

    Just declare a OUT parameter and then set the value as:

    create procedure proc_name(OUT var2 int)
    language sql
    begin
    declare var1 integer;
    select column1 into var1 from table where column2=value;
    set var2 = var1;
    end;

    cheers,
    Prashant

Posting Permissions

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