Greetings,
I need to drop a couple of tables from the dictionary, and I know that I need to use:
DROP TABLE <TABLENAME> IN DICTIONARY
but then, I need to drop the table only if it exists.
Essentially I am making a .SQL file that would be run using the PSQL ODBC driver, and if the above statement is run for non-existing tables, an error is bombed.
So I would like to execute the SQL query conditionally.
I know that I can do this using a simple 'IF EXISTS' condition in Microsoft SQL, but the equivalent doesnt seem to be available with PSQL.
I did unearth the:
SELECT * FROM Person p WHERE EXISTS
(SELECT * FROM Enrolls e WHERE e.Student_ID = p.id
AND Grade = 4.0)
example in the documentation, but the;
DROP TABLE <TABLENAME> IN DICTIONARY WHERE EXISTS (select * from X$file where xf$name = '<TABLENAME>')
will not work as the DROP statement doesnt support this.
I am essentially looking for a work around.
Thanks for the help thats on its way
SHAMmmmm...
I need to drop a couple of tables from the dictionary, and I know that I need to use:
DROP TABLE <TABLENAME> IN DICTIONARY
but then, I need to drop the table only if it exists.
Essentially I am making a .SQL file that would be run using the PSQL ODBC driver, and if the above statement is run for non-existing tables, an error is bombed.
So I would like to execute the SQL query conditionally.
I know that I can do this using a simple 'IF EXISTS' condition in Microsoft SQL, but the equivalent doesnt seem to be available with PSQL.
I did unearth the:
SELECT * FROM Person p WHERE EXISTS
(SELECT * FROM Enrolls e WHERE e.Student_ID = p.id
AND Grade = 4.0)
example in the documentation, but the;
DROP TABLE <TABLENAME> IN DICTIONARY WHERE EXISTS (select * from X$file where xf$name = '<TABLENAME>')
will not work as the DROP statement doesnt support this.
I am essentially looking for a work around.
Thanks for the help thats on its way
SHAMmmmm...