Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2007
    Posts
    42

    Unanswered: @declare in stored procedure

    db2 ESE
    i just want to get a hint.. because whenever i create stored procedure, i don't know when will to declare variables or not. it also confused me when i see examples with or without variable declaration, but both works! tnx..

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    I am not sure if I understand your question properly, but we only declare variables if they are needed int the stored procedure.

    Andy

  3. #3
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    Declaring variables in SP is straight forward:
    Code:
    CREATE PROCEDURE ...
       BEGIN
          DECLARE var1 INT;
          SET var1 = ( SELECT ... );
       END@
    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
  •