11.2 The create or replace type statement is added and the FORCE option is added. Before 11.2, as long as other tables or types depend on the current object, this object cannot be replaced:
SQL> create type t_num_tab is table of number;
2/Type created. SQL> create type t_record is object (id number, n_tab t_num_tab );
2/Type created. SQL> create or replace type t_num_tab is table of number (5 );
2/
Create or replace type t_num_tab is table of number (5 );
*
ERROR at line 1:
ORA-02303: cannot drop or replace a type with type or table dependents this is a situation before 11.2, trying to execute create or replace will cause a ORA-2303 error, Oracle added FORCE functionality in 11.2, so that a TYPE-dependent object can still perform the REPLACE operation: SQL> create or replace type t_num_tab force is tbable of number (5 );
2/Type created. SQL> select * from v $ version; BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0-64bit Production
PL/SQL Release 11.2.0.3.0-Production
CORE 11.2.0.3.0 Production
TNS for Solaris: Version 11.2.0.3.0-Production
NLSRTL Version 11.2.0.3.0-Production it is interesting that the location of the FORCE statement does not take effect, then the ORA-2303 error will also be reported, and does not cause the statement error:
SQL> create or replace force type t_num_tab is table of number (5 );
Create or replace force type t_num_tab is table of number (5)
*
ERROR at line 1:
ORA-02303: cannot drop or replace a type with type or table dependents
SQL> create or replace type t_num_tab is table of number (5) force;
2/
Create or replace type t_num_tab is table of number (5) force;
*
ERROR at line 1:
ORA-02303: cannot drop or replace a type with type or table dependents this last function is only valid for objects that are dependent on the TYPE. Once the object is dependent on the table, the FORCE function does not work either:
SQL> create table t_type_tab (id number, c_tab t_num_tab)
2 nested table c_tab store tb as c_tab_tab; Table created. SQL> create or replace type t_num_tab force is table of number (6 );
2/
Create or replace type t_num_tab force is table of number (6 );
*
ERROR at line 1:
ORA-22866: the error message for cannot replace a type with table dependentsOracle has also become a ORA-22866. In fact, it can be expected that once a table is created, it is equivalent to the physical work. If the dependent type changes, it will affect the reading and writing of existing data in the table. However, Oracle can proceed further, that is, if the table segment is not created or the table is not inserted with data, the dependent object can be modified.