views:

32

answers:

1

Is there a way to alter an object type to add an attribute only if it doesn't already exist? I am writing a script that will be run on multiple databases. I'm trying to avoid unnecessary PLS-00410 errors (duplicate fields in RECORD,TABLE or argument list are not permitted).

Something like the following:

ALTER TYPE employee
ADD ATTRIBUTE --IF NOT EXISTS
  (address2 VARCHAR2(30))
CASCADE;

If there is no elegant inline solution like the above, is there a system table I can look at? ALL_TYPES only lists the number of attributes per type, not the specific attributes.

+2  A: 

ALL_TYPE_ATTRS appears to be what you're looking for. It's a child of ALL_TYPES for OBJECT types.

Adam Musch