Home » SQL & PL/SQL » SQL & PL/SQL » ORA-02303: cannot drop or replace a type with type or table dependents (Oracle 11g R2, Windows Server 2003 sp2)
ORA-02303: cannot drop or replace a type with type or table dependents [message #541592] |
Wed, 01 February 2012 05:00  |
Andrey_R
Messages: 441 Registered: January 2012 Location: Israel
|
Senior Member |
|
|
Hi all,
i am trying to run a script in which a command tries to create or replace a type.
i get this error:
ORA-02303: cannot drop or replace a type with type or table dependents
SQL>
SQL> --create a test user:
SQL>
SQL> create user tuser identified by tuser
2 /
User created.
SQL>
SQL> --grant some privileges:
SQL>
SQL> grant create session,resource, select any table, create any type,create any tab
2 /
Grant succeeded.
SQL>
SQL> conn tuser/tuser@service_name
Connected.
SQL>
SQL> --create the type:
SQL>
SQL> create or replace type t1 as object (obj_type varchar(15))
2 /
Type created.
SQL>
SQL>
SQL> --create a table dependant on the type:
SQL>
SQL> create table dpntnt_table
2 (
3 id1 number(7),
4 name1 t1
5 )
6 /
Table created.
SQL>
SQL> --then change the type:
SQL>
SQL> create or replace type t1 as object (obj_type number(15))
2 /
create or replace type t1 as object (obj_type number(15))
*
ERROR at line 1:
ORA-02303: cannot drop or replace a type with type or table dependents
SQL>
SQL> --if i'll do FORCE action on the type - it'll corrupt my depandant table:
SQL>
SQL> drop type t1 FORCE
2 /
Type dropped.
SQL>
SQL>
SQL>
SQL>
SQL> desc dpntnt_table
Name Null? Type
----------------------------------------- -------- ----------------------------
ID1 NUMBER(7)
SQL>
SQL>
SQL>
SQL> --if i re-create it - my table is still corrupted:
SQL>
SQL>
SQL> create or replace type t1 as object (obj_type number(15))
2 /
Type created.
SQL>
SQL>
SQL>
SQL> desc dpntnt_table
Name Null? Type
----------------------------------------- -------- ----------------------------
ID1 NUMBER(7)
SQL>
--if i re-create it - my table is still corrupted:
create or replace type t1 as object (obj_type number(15))
/
desc dpntnt_table
[/code]
1. If i'll do drop type FORCE what will happen to the dependent object(might be a table for example) ?
2. I understand that this type is already assigned to some object, but i can't seem to find out which one.
how do i find out which object is depending on the type i want to create or replace?
any advice?
Thanks and Regards,
Andrey
[Updated on: Wed, 01 February 2012 05:02] Report message to a moderator
|
|
|
|
|
|
|
Goto Forum:
Current Time: Fri Jun 06 00:33:36 CDT 2025
|