gotchaMinor
What is the difference between these two create table statements?
Viewed 0 times
thethesewhatcreatestatementsdifferencetwobetweentable
Problem
a)
b)
Code from here.
In the first one, we are creating a column of type
SQL> CREATE TABLE xml_tab1(poDoc XMLTYPE);
Table created.
SQL> desc xml_tab1;
Name Null? Type
----------------------------------------- -------- ----------------------------
PODOC PUBLIC.XMLTYPEb)
SQL> CREATE TABLE xml_tab2 of XMLType;
Table created.
SQL> desc xml_tab2;
Name Null? Type
----------------------------------------- -------- ----------------------------
TABLE of PUBLIC.XMLTYPECode from here.
In the first one, we are creating a column of type
XMLTYPE. What does the second one do? When should I use the first or the second one?Solution
The second statement is creating an object table.
It is almost never the case that you really want to use an object table. That was something that was introduced in the 8i time frame when Oracle was making the database object oriented. While a lot of the object oriented PL/SQL enhancements have been useful, using object types in SQL is not something that I'd recommend.
It is almost never the case that you really want to use an object table. That was something that was introduced in the 8i time frame when Oracle was making the database object oriented. While a lot of the object oriented PL/SQL enhancements have been useful, using object types in SQL is not something that I'd recommend.
Context
StackExchange Database Administrators Q#1110, answer score: 7
Revisions (0)
No revisions yet.