Check if Tablespace Exists?
Hi guys,
I'm writing a schema for automation of a tablespace creation, and I want to (at the beginning) check if it exists, then drop it if it does prior to creating it.
Something like:
Code:
IF EXISTS(
SELECT id
FROM sys.tablespaces
WHERE name = 'my_table_space_name')
BEGIN
DROP TABLESPACE my_table_space_name INCLUDING CONTENTS;
END;
CREATE TABLESPACE my_table_space_name
....
My question is how do I determine if the tablespace exists? (top part). I've been researching this for an hour now and can't find documentation on the sys schema.
Thanks in advance for your help !!
:)
Re: Check if Tablespace Exists?
I wouldn't worry about it. Just issue the drop tablespace command -- you'll just get an error if it doesn't exist.