“DROP object IF EXISTS” in Oracle?

When you run installations and patches you often have log files full of error messages that can be ignored, such as dropping objects that don’t exist prior to creating them, or in some cases creating objects that already exist. As a result, trying to identify “real” errors is like looking for a needle in a haystack.

It would be nice if these meaningless errors could be supressed. I guess it would be a little like the IGNORE=Y option in the import utility.

Of course, there is a judgement call about what constitutes a real error. In some cases, an object not being present when you try to drop it signifies something is very wrong, but for many scripts it’s no big deal.

If Oracle included a “DROP object IF EXISTS” syntax like mySQL, and maybe even a “CREATE object IF MISSING” syntax, it would be a real bonus.

I feel an enhancement request coming on :)



Update: The enhancement request has now been logged on Metalink (ER# 5151826) :)