What is the meaning of the FORCE keyword in a CREATE OR REPLACE TYPE statement?

17.5k views Asked by At

What does the keyword FORCE mean in this statement:

 CREATE OR REPLACE TYPE object_name FORCE IS TABLE OF NUMBER;
1

There are 1 answers

0
GolezTrol On

It means forcing (re)creation of the type, even if it has other type dependencies. For instance, if you have these types:

type O_Object is (
  Prop1 INT,
  Prop2 INT
);
type T_ObjectTable is table of O_Object;

If you would like to modify O_Object, you will get an error, because T_ObjectTable depends on it. Using FORCE, you can recreate the object (though T_ObjectTable will need recompiling afterwards).

This won't work though if there are table dependencies (actual tables, not table-of-object types). In that case, the create statement will fail with or without FORCE.

It's in the docs too :)