title: How to delete a tablespace if it exists in DB2
body: <p>I've been trying to delete a tablespace if it exists in DB2 (Z/OS) if it exists. The purpose of this is to be able to have a script to create a new dev or replace an existing dev database.</p>
  
  <p>I've been trying something like:</p>
  
  <pre><code>BEGIN 
      IF (exists (SELECT * FROM SYSIBM.SYSTABLESPACES WHERE TBSPACE = 'SGE')) THEN 
          DROP TABLESPACE "SGE";
      END IF;
  END @
  </code></pre>
  
  <p>But it doesn't seem to be taking the <code>DROP</code> (at least on Data Studio 4.1). Is there anything else I should be doing?</p>
  
  <p>Thanks in advance</p>