<?xml version="1.0" encoding="utf-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Oracle RDBMS 11gR2 &#8211; alter or replace user defined types even when there are dependencies</title>
	<atom:link href="http://technology.amis.nl/blog/6122/oracle-rdbms-11gr2-drop-and-replace-user-defined-types-even-when-there-are-dependencies/feed" rel="self" type="application/rss+xml" />
	<link>http://technology.amis.nl/blog/6122/oracle-rdbms-11gr2-drop-and-replace-user-defined-types-even-when-there-are-dependencies</link>
	<description>Weblog for the AMIS Technology corner</description>
	<lastBuildDate>Fri, 10 Feb 2012 16:47:37 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Marcel Hoefs</title>
		<link>http://technology.amis.nl/blog/6122/oracle-rdbms-11gr2-drop-and-replace-user-defined-types-even-when-there-are-dependencies/comment-page-1#comment-348889</link>
		<dc:creator>Marcel Hoefs</dc:creator>
		<pubDate>Mon, 05 Oct 2009 15:40:17 +0000</pubDate>
		<guid isPermaLink="false">http://technology.amis.nl/blog/?p=6122#comment-348889</guid>
		<description>An alternative that works in 9i and 10g is the following:

SQL&gt; create or replace
  2  type person_t as object
  3  ( first_name varchar2(30)
  4  , last_name  varchar2(30)
  5  , birthdate  date
  6  )
  7  /

Type is aangemaakt.

SQL&gt; create or replace
  2  type personal_relation_t as object
  3  ( relationship_type varchar2(20)
  4  , start_date        date
  5  , from_person       person_t
  6  , with_person       person_t
  7  )
  8  /

Type is aangemaakt.

SQL&gt; DROP TYPE person_t FORCE
  2  /

Type is verwijderd.

SQL&gt; create or replace
  2  type person_t as object
  3  ( first_name varchar2(30)
  4  , last_name  varchar2(30)
  5  , birthdate  date
  6  , gender     varchar2(1)
  7  )
  8  /

Type is aangemaakt.

SQL&gt; DESC person_t
 Naam                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 FIRST_NAME                                         VARCHAR2(30)
 LAST_NAME                                          VARCHAR2(30)
 BIRTHDATE                                          DATE
 GENDER                                             VARCHAR2(1)

SQL&gt; DESC personal_relation_t
 Naam                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 RELATIONSHIP_TYPE                                  VARCHAR2(20)
 START_DATE                                         DATE
 FROM_PERSON                                        PERSON_T
 WITH_PERSON                                        PERSON_T</description>
		<content:encoded><![CDATA[<p>An alternative that works in 9i and 10g is the following:</p>
<p>SQL&gt; create or replace<br />
  2  type person_t as object<br />
  3  ( first_name varchar2(30)<br />
  4  , last_name  varchar2(30)<br />
  5  , birthdate  date<br />
  6  )<br />
  7  /</p>
<p>Type is aangemaakt.</p>
<p>SQL&gt; create or replace<br />
  2  type personal_relation_t as object<br />
  3  ( relationship_type varchar2(20)<br />
  4  , start_date        date<br />
  5  , from_person       person_t<br />
  6  , with_person       person_t<br />
  7  )<br />
  8  /</p>
<p>Type is aangemaakt.</p>
<p>SQL&gt; DROP TYPE person_t FORCE<br />
  2  /</p>
<p>Type is verwijderd.</p>
<p>SQL&gt; create or replace<br />
  2  type person_t as object<br />
  3  ( first_name varchar2(30)<br />
  4  , last_name  varchar2(30)<br />
  5  , birthdate  date<br />
  6  , gender     varchar2(1)<br />
  7  )<br />
  8  /</p>
<p>Type is aangemaakt.</p>
<p>SQL&gt; DESC person_t<br />
 Naam                                      Null?    Type<br />
 &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
 FIRST_NAME                                         VARCHAR2(30)<br />
 LAST_NAME                                          VARCHAR2(30)<br />
 BIRTHDATE                                          DATE<br />
 GENDER                                             VARCHAR2(1)</p>
<p>SQL&gt; DESC personal_relation_t<br />
 Naam                                      Null?    Type<br />
 &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
 RELATIONSHIP_TYPE                                  VARCHAR2(20)<br />
 START_DATE                                         DATE<br />
 FROM_PERSON                                        PERSON_T<br />
 WITH_PERSON                                        PERSON_T</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: radino</title>
		<link>http://technology.amis.nl/blog/6122/oracle-rdbms-11gr2-drop-and-replace-user-defined-types-even-when-there-are-dependencies/comment-page-1#comment-348818</link>
		<dc:creator>radino</dc:creator>
		<pubDate>Thu, 03 Sep 2009 14:26:31 +0000</pubDate>
		<guid isPermaLink="false">http://technology.amis.nl/blog/?p=6122#comment-348818</guid>
		<description>&quot;Especially the fact that once a type has been created and has been referenced by other types, it cannot be altered. In order to change a small (or big thing) in a single type, it may be necessary to drop a whole bunch of types that are all somehow related to each other&quot;

That&#039;s not true. It can be altered by issuing ALTER TYPE statement (at least from 9i release 1. I don&#039;t have older doc).
http://download.oracle.com/docs/cd/A91202_01/901_doc/server.901/a90125/statements_43.htm#2057830

tested in 11.1.0.6.0:

SQL&gt; create type a as object(a number);
  2  /
 
Type created
 
SQL&gt; create type b as object(b a);
  2  /
 
Type created
 
SQL&gt; alter type a add attribute (c number) invalidate;
 
Type altered
 
SQL&gt; alter type a add attribute (d number) cascade;
 
Type altered
 
SQL&gt; desc a
Element Type   
------- ------ 
A       NUMBER 
C       NUMBER 
D       NUMBER 
 
SQL&gt; desc b
Element Type 
------- ---- 
B       A</description>
		<content:encoded><![CDATA[<p>&#8220;Especially the fact that once a type has been created and has been referenced by other types, it cannot be altered. In order to change a small (or big thing) in a single type, it may be necessary to drop a whole bunch of types that are all somehow related to each other&#8221;</p>
<p>That&#8217;s not true. It can be altered by issuing ALTER TYPE statement (at least from 9i release 1. I don&#8217;t have older doc).<br />
<a href="http://download.oracle.com/docs/cd/A91202_01/901_doc/server.901/a90125/statements_43.htm#2057830" rel="nofollow">http://download.oracle.com/docs/cd/A91202_01/901_doc/server.901/a90125/statements_43.htm#2057830</a></p>
<p>tested in 11.1.0.6.0:</p>
<p>SQL&gt; create type a as object(a number);<br />
  2  /</p>
<p>Type created</p>
<p>SQL&gt; create type b as object(b a);<br />
  2  /</p>
<p>Type created</p>
<p>SQL&gt; alter type a add attribute (c number) invalidate;</p>
<p>Type altered</p>
<p>SQL&gt; alter type a add attribute (d number) cascade;</p>
<p>Type altered</p>
<p>SQL&gt; desc a<br />
Element Type<br />
&#8212;&#8212;- &#8212;&#8212;<br />
A       NUMBER<br />
C       NUMBER<br />
D       NUMBER </p>
<p>SQL&gt; desc b<br />
Element Type<br />
&#8212;&#8212;- &#8212;-<br />
B       A</p>
]]></content:encoded>
	</item>
</channel>
</rss>

