dbTalk Databases Forums  

user defined data type: does they exist ?

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss user defined data type: does they exist ? in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
alberto.roller@gmail.com
 
Posts: n/a

Default user defined data type: does they exist ? - 01-17-2008 , 08:20 AM






I'm migrating an application from sql server to oracle.

We have tables with column that use user defined data type, for
example

CREATE TABLE AA (
Column1 CODE
)

Where CODE is defined as varchar(50)

Is there a way to create an equivalent CODE in oracle ?


Reply With Quote
  #2  
Old   
Mark D Powell
 
Posts: n/a

Default Re: user defined data type: does they exist ? - 01-17-2008 , 08:54 AM






On Jan 17, 9:20*am, alberto.rol... (AT) gmail (DOT) com wrote:
Quote:
I'm migrating an application from sql server to oracle.

We have tables with column that use user defined data type, for
example

CREATE TABLE AA (
* * Column1 *CODE
)

Where CODE is defined as varchar(50)

Is there a way to create an equivalent CODE in oracle ?
Yes, Oracle had this feature since version 8.0.

Read the following:
Oracle version# Application Developers Guide - Fundamentals
Application Developers Guide - Object-Relational Features
SQL Manual entry CREATE TYPE
PL/SQL User's Guide and Reference -- contains many examples of using
object types

HTH -- Mark D Powell --



Reply With Quote
  #3  
Old   
Mark D Powell
 
Posts: n/a

Default Re: user defined data type: does they exist ? - 01-17-2008 , 08:54 AM



On Jan 17, 9:20*am, alberto.rol... (AT) gmail (DOT) com wrote:
Quote:
I'm migrating an application from sql server to oracle.

We have tables with column that use user defined data type, for
example

CREATE TABLE AA (
* * Column1 *CODE
)

Where CODE is defined as varchar(50)

Is there a way to create an equivalent CODE in oracle ?
Yes, Oracle had this feature since version 8.0.

Read the following:
Oracle version# Application Developers Guide - Fundamentals
Application Developers Guide - Object-Relational Features
SQL Manual entry CREATE TYPE
PL/SQL User's Guide and Reference -- contains many examples of using
object types

HTH -- Mark D Powell --



Reply With Quote
  #4  
Old   
Mark D Powell
 
Posts: n/a

Default Re: user defined data type: does they exist ? - 01-17-2008 , 08:54 AM



On Jan 17, 9:20*am, alberto.rol... (AT) gmail (DOT) com wrote:
Quote:
I'm migrating an application from sql server to oracle.

We have tables with column that use user defined data type, for
example

CREATE TABLE AA (
* * Column1 *CODE
)

Where CODE is defined as varchar(50)

Is there a way to create an equivalent CODE in oracle ?
Yes, Oracle had this feature since version 8.0.

Read the following:
Oracle version# Application Developers Guide - Fundamentals
Application Developers Guide - Object-Relational Features
SQL Manual entry CREATE TYPE
PL/SQL User's Guide and Reference -- contains many examples of using
object types

HTH -- Mark D Powell --



Reply With Quote
  #5  
Old   
Mark D Powell
 
Posts: n/a

Default Re: user defined data type: does they exist ? - 01-17-2008 , 08:54 AM



On Jan 17, 9:20*am, alberto.rol... (AT) gmail (DOT) com wrote:
Quote:
I'm migrating an application from sql server to oracle.

We have tables with column that use user defined data type, for
example

CREATE TABLE AA (
* * Column1 *CODE
)

Where CODE is defined as varchar(50)

Is there a way to create an equivalent CODE in oracle ?
Yes, Oracle had this feature since version 8.0.

Read the following:
Oracle version# Application Developers Guide - Fundamentals
Application Developers Guide - Object-Relational Features
SQL Manual entry CREATE TYPE
PL/SQL User's Guide and Reference -- contains many examples of using
object types

HTH -- Mark D Powell --



Reply With Quote
  #6  
Old   
alberto.roller@gmail.com
 
Posts: n/a

Default Re: user defined data type: does they exist ? - 01-18-2008 , 04:39 AM




Quote:
SQL Manual entry CREATE TYPE
PL/SQL User's Guide and Reference *-- contains many examples of using
object types

hello, thanks. I've already tried it, but it seems to me that it can
"only" create complex types, something like struct in C++.

And to use them, I have to use a "constructor" in the insert
statement.

I need to be able to do only something like

insert into table AA (column1) values ('this is a string with maximum
50 chars')

and not something like

insert into table AA (column1) values (CODE('this is a string with
maximum 50 chars'))

Maybe I missed something on the create type syntax ?

thank you very much!




Reply With Quote
  #7  
Old   
alberto.roller@gmail.com
 
Posts: n/a

Default Re: user defined data type: does they exist ? - 01-18-2008 , 04:39 AM




Quote:
SQL Manual entry CREATE TYPE
PL/SQL User's Guide and Reference *-- contains many examples of using
object types

hello, thanks. I've already tried it, but it seems to me that it can
"only" create complex types, something like struct in C++.

And to use them, I have to use a "constructor" in the insert
statement.

I need to be able to do only something like

insert into table AA (column1) values ('this is a string with maximum
50 chars')

and not something like

insert into table AA (column1) values (CODE('this is a string with
maximum 50 chars'))

Maybe I missed something on the create type syntax ?

thank you very much!




Reply With Quote
  #8  
Old   
alberto.roller@gmail.com
 
Posts: n/a

Default Re: user defined data type: does they exist ? - 01-18-2008 , 04:39 AM




Quote:
SQL Manual entry CREATE TYPE
PL/SQL User's Guide and Reference *-- contains many examples of using
object types

hello, thanks. I've already tried it, but it seems to me that it can
"only" create complex types, something like struct in C++.

And to use them, I have to use a "constructor" in the insert
statement.

I need to be able to do only something like

insert into table AA (column1) values ('this is a string with maximum
50 chars')

and not something like

insert into table AA (column1) values (CODE('this is a string with
maximum 50 chars'))

Maybe I missed something on the create type syntax ?

thank you very much!




Reply With Quote
  #9  
Old   
alberto.roller@gmail.com
 
Posts: n/a

Default Re: user defined data type: does they exist ? - 01-18-2008 , 04:39 AM




Quote:
SQL Manual entry CREATE TYPE
PL/SQL User's Guide and Reference *-- contains many examples of using
object types

hello, thanks. I've already tried it, but it seems to me that it can
"only" create complex types, something like struct in C++.

And to use them, I have to use a "constructor" in the insert
statement.

I need to be able to do only something like

insert into table AA (column1) values ('this is a string with maximum
50 chars')

and not something like

insert into table AA (column1) values (CODE('this is a string with
maximum 50 chars'))

Maybe I missed something on the create type syntax ?

thank you very much!




Reply With Quote
  #10  
Old   
news.verizon.net
 
Posts: n/a

Default Re: user defined data type: does they exist ? - 01-18-2008 , 06:06 AM




<alberto.roller (AT) gmail (DOT) com> wrote


Quote:
SQL Manual entry CREATE TYPE
PL/SQL User's Guide and Reference -- contains many examples of using
object types

hello, thanks. I've already tried it, but it seems to me that it can
"only" create complex types, something like struct in C++.

And to use them, I have to use a "constructor" in the insert
statement.

I need to be able to do only something like

insert into table AA (column1) values ('this is a string with maximum
50 chars')

and not something like

insert into table AA (column1) values (CODE('this is a string with
maximum 50 chars'))

Maybe I missed something on the create type syntax ?

thank you very much!

What problem are you trying to solve? From your example, it would have been
better to just do varchar2(50) instead of creating a type of varchar2(50).
From your question I assumed that you were giving a trivial example, and
wanted the equivalent of a class or struct. (eg a type with multiple slots
or members). If you only need primitive types use the primitive types that
Oracle supplies and don't redefine them. So the answer is yes, if you want
to use types you have to use a constructor. If you look at the docs more
you will see that you can make the type more like a class, with a variety of
constructors and member functions etc. (Which is why you need to use a
constructor.)
Jim




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.