I want to do something like
DROP PROJECTION IF EXISTS myProjection;
Apparently I can use IF EXISTS for a table but not a projection.
I understand if I drop the table with CASCADE, that should drop the corresponding projections, but I apparently have some orphaned projections which I do not have a track of. And sometimes when I rename tables/projections, it fails saying projection already exists.
The Drop Projection page and this stackoverflow page for generic sql do not help much.
Edit: I am using this in Mybatis Migrations. So my entire migration would fail if there is an error in any of the scripts. So, no I can not ignore the error.
If there is no IF EXISTS for a projection -- is there a programatic way (LIKE TSQL/PLSQL) where I could specify a condition to check if the projection exists and take an action whether to drop it or not?