Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Type Aliases
A copy of this was sent to Jenda_at_Krynicky.cz (Jenda Krynicky)
(if that email address didn't require changing)
On Wed, 28 Jul 1999 13:37:14 GMT, you wrote:
>I admit I am stupid etc. etc. etc. etc. :-)
>
>How do I define a type synonym?
>
>I would like to define eg. INT to mean NUMBER(12,0) so that I
>do not have
>to
you can create object types in Oracle8 and up:
SQL> create type String as object ( s varchar2(255) )
2 /
Type created.
SQL> create table t ( x string );
Table created.
SQL> desc t
Name Null? Type ------------------------------- -------- ---- X STRING SQL> desc string Name Null? Type ------------------------------- -------- ---- S VARCHAR2(255)
but it is not really the same thing as you are asking (adds a level of derefening in the query -- T has an object column X that has a component S -- the column you are after is T.X.S -- not just T.X)
These types are more useful for complex/many attributed objects such as:
SQL> create type AddressType as object
2 ( city varchar2(25),
3 street varchar2(25),
4 zip int
5 )
6 /
Type created.
SQL>
SQL> drop table t;
Table dropped.
SQL> create table t ( x AddressType );
Table created.
SQL> desc t
Name Null? Type ------------------------------- -------- ---- X ADDRESSTYPE SQL> desc AddressType Name Null? Type ------------------------------- -------- ---- CITY VARCHAR2(25) STREET VARCHAR2(25) ZIP NUMBER(38)
>write NUMBER(12,0) ever and over again and remember if I
>used 12 or
>whatever.
>
>It this possible and how ?
>
>Thanks a lot.
>
>Please do CC: me by e-mail, I need this quick.
>Sorry I know this is considered bad taste, but I realy do not
>have time
>to watch all
>newsgroups of all programs/systems/languages I need to
>work with.
>
>Jenda_at_Krynicky.cz
>http://Jenda.Krynicky.cz
--
See http://govt.us.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'...
Current article is "Part I of V, Autonomous Transactions" updated June 21'st
Thomas Kyte tkyte_at_us.oracle.com Oracle Service Industries Reston, VA USA
Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Wed Jul 28 1999 - 09:48:23 CDT
![]() |
![]() |