title: How to get variable value from inside a stored procedure in DB2?
body: <p>This seems like it should be very easy...anyway, it is in MS SQL Server</p>
  
  <p>In a DB2 stored procedure, how can I just get the value of a variable?  Say I have the following stored procedure:</p>
  
  <pre><code>CREATE PROCEDURE etl.TestABC( 
  ) 
  LANGUAGE SQL 
    BEGIN 
      declare      Stmt              varchar(2048); 
      set Stmt = 'this is a test';
  -- print Stmt;
  -- select Stmt;
  
  
      return 0; 
  END @ 
  </code></pre>
  
  <p>I'd like to print out the value of Stmt after I set it.  Print doesn't work, select doesn't work.  Somebody said I have to insert it to a table first, and then get it after I run the stored procedure.  Is this really necessary?</p>
  
  <p>Thanks,
  Sylvia</p>
  
  <p>EDIT: I should have made clearer that I want to see the value of Stmt each time after I set it, and I may need to set it multiple times within the same stored procedure.</p>