Domanda

I have this type that I have created :

create type baseType as Object(...) NOT Instantiable not Final

and I'd like to add constraints to some fields. The problem is that this type in not instantiable and therefore, I can't add a constraint to its fields. So then, when I create my inheriting types

create type childType1 under baseType (...) 

create type childType2 under baseType  (...) 

I'll have to add constraints to all the children tables. Is this the correct way to go? I thought there would be a way to add the constraints on the common fields only in the parent type. Is there a way of doing that?

È stato utile?

Soluzione

You can't add constraints to object types at all - constraints are on a table. If the object is not instantiable, you can't have a table based on it, ergo no constraints on it.

I guess the answer would be to make the object type Instantiable. Then you can create a table based on it with constraints. Of course, these constraints won't be "inherited" by the child types.

All that said, however, I personally avoid Oracle object types when I can.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top