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
  #21  
Old   
Michael Austin
 
Posts: n/a

Default Re: user defined data type: does they exist ? - 01-26-2008 , 07:00 PM






Mark D Powell wrote:
Quote:
On Jan 18, 5:39 am, alberto.rol... (AT) gmail (DOT) com wrote:
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!

If you object type consists of a single varchar2 value why do you need
an object at all?

My professional opinion based on experience and common sense is that
objects do not belong stored in a relational database but should be
created and manipulated in the application layer.

Adhoc query tools and end users do not relate to stored objects.

You can however sometimes use objects to advantage in PL/SQL code that
manipulates data.

HTH -- Mark D Powell --

Mark,

I believe the TYPE could also represent objects with a single definition:

CREATE TYPE demo_typ1 AS OBJECT (a1 VARCHAR2(20));

CREATE TABLE demo_tab1 (b1 NUMBER, b2 demo_typ1);

This is more analogous to the Oracle Rdb (formerly DEC Rdb) DOMAIN. You
can create a domain of a specified name, size and default values... for
example:

SQL> CREATE DOMAIN ADDRESS_DATA2_DOM VARCHAR2(20) DEFAULT NULL;

SQL> CREATE TABLE X (ADDRESS_2 ADDRESS_DATA2_DOM);
SQL> CREATE TABLE y (ADDRESS_1 ADDRESS_DATA2_DOM);

And columns ADDRESS_1 and ADDRESS_2 will assume the characteristics and
default value from domain address_data2_dom.

Any where you need a 20 character data type you can use this domain.
Cool thing is that when you then alter the domain to be - say
varchar2(30) - any where you have used this domain, the column
automatically gets modified - so you don't have to find all the places
where you used it and alter that table.



Reply With Quote
  #22  
Old   
William Robertson
 
Posts: n/a

Default Re: user defined data type: does they exist ? - 01-27-2008 , 05:43 PM






On Jan 27, 1:00 am, Michael Austin <maus... (AT) firstdbasource (DOT) com> wrote:
Quote:
Mark D Powell wrote:
On Jan 18, 5:39 am, alberto.rol... (AT) gmail (DOT) com wrote:
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!

If you object type consists of a single varchar2 value why do you need
an object at all?

My professional opinion based on experience and common sense is that
objects do not belong stored in a relational database but should be
created and manipulated in the application layer.

Adhoc query tools and end users do not relate to stored objects.

You can however sometimes use objects to advantage in PL/SQL code that
manipulates data.

HTH -- Mark D Powell --

Mark,

I believe the TYPE could also represent objects with a single definition:

CREATE TYPE demo_typ1 AS OBJECT (a1 VARCHAR2(20));

CREATE TABLE demo_tab1 (b1 NUMBER, b2 demo_typ1);

This is more analogous to the Oracle Rdb (formerly DEC Rdb) DOMAIN. You
can create a domain of a specified name, size and default values... for
example:

SQL> CREATE DOMAIN ADDRESS_DATA2_DOM VARCHAR2(20) DEFAULT NULL;

SQL> CREATE TABLE X (ADDRESS_2 ADDRESS_DATA2_DOM);
SQL> CREATE TABLE y (ADDRESS_1 ADDRESS_DATA2_DOM);

And columns ADDRESS_1 and ADDRESS_2 will assume the characteristics and
default value from domain address_data2_dom.

Any where you need a 20 character data type you can use this domain.
Cool thing is that when you then alter the domain to be - say
varchar2(30) - any where you have used this domain, the column
automatically gets modified - so you don't have to find all the places
where you used it and alter that table.
There is no CREATE DOMAIN in Oracle AFAIK.

In answer to the original question, no, you cannot create scalar types
in Oracle.


Reply With Quote
  #23  
Old   
William Robertson
 
Posts: n/a

Default Re: user defined data type: does they exist ? - 01-27-2008 , 05:43 PM



On Jan 27, 1:00 am, Michael Austin <maus... (AT) firstdbasource (DOT) com> wrote:
Quote:
Mark D Powell wrote:
On Jan 18, 5:39 am, alberto.rol... (AT) gmail (DOT) com wrote:
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!

If you object type consists of a single varchar2 value why do you need
an object at all?

My professional opinion based on experience and common sense is that
objects do not belong stored in a relational database but should be
created and manipulated in the application layer.

Adhoc query tools and end users do not relate to stored objects.

You can however sometimes use objects to advantage in PL/SQL code that
manipulates data.

HTH -- Mark D Powell --

Mark,

I believe the TYPE could also represent objects with a single definition:

CREATE TYPE demo_typ1 AS OBJECT (a1 VARCHAR2(20));

CREATE TABLE demo_tab1 (b1 NUMBER, b2 demo_typ1);

This is more analogous to the Oracle Rdb (formerly DEC Rdb) DOMAIN. You
can create a domain of a specified name, size and default values... for
example:

SQL> CREATE DOMAIN ADDRESS_DATA2_DOM VARCHAR2(20) DEFAULT NULL;

SQL> CREATE TABLE X (ADDRESS_2 ADDRESS_DATA2_DOM);
SQL> CREATE TABLE y (ADDRESS_1 ADDRESS_DATA2_DOM);

And columns ADDRESS_1 and ADDRESS_2 will assume the characteristics and
default value from domain address_data2_dom.

Any where you need a 20 character data type you can use this domain.
Cool thing is that when you then alter the domain to be - say
varchar2(30) - any where you have used this domain, the column
automatically gets modified - so you don't have to find all the places
where you used it and alter that table.
There is no CREATE DOMAIN in Oracle AFAIK.

In answer to the original question, no, you cannot create scalar types
in Oracle.


Reply With Quote
  #24  
Old   
William Robertson
 
Posts: n/a

Default Re: user defined data type: does they exist ? - 01-27-2008 , 05:43 PM



On Jan 27, 1:00 am, Michael Austin <maus... (AT) firstdbasource (DOT) com> wrote:
Quote:
Mark D Powell wrote:
On Jan 18, 5:39 am, alberto.rol... (AT) gmail (DOT) com wrote:
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!

If you object type consists of a single varchar2 value why do you need
an object at all?

My professional opinion based on experience and common sense is that
objects do not belong stored in a relational database but should be
created and manipulated in the application layer.

Adhoc query tools and end users do not relate to stored objects.

You can however sometimes use objects to advantage in PL/SQL code that
manipulates data.

HTH -- Mark D Powell --

Mark,

I believe the TYPE could also represent objects with a single definition:

CREATE TYPE demo_typ1 AS OBJECT (a1 VARCHAR2(20));

CREATE TABLE demo_tab1 (b1 NUMBER, b2 demo_typ1);

This is more analogous to the Oracle Rdb (formerly DEC Rdb) DOMAIN. You
can create a domain of a specified name, size and default values... for
example:

SQL> CREATE DOMAIN ADDRESS_DATA2_DOM VARCHAR2(20) DEFAULT NULL;

SQL> CREATE TABLE X (ADDRESS_2 ADDRESS_DATA2_DOM);
SQL> CREATE TABLE y (ADDRESS_1 ADDRESS_DATA2_DOM);

And columns ADDRESS_1 and ADDRESS_2 will assume the characteristics and
default value from domain address_data2_dom.

Any where you need a 20 character data type you can use this domain.
Cool thing is that when you then alter the domain to be - say
varchar2(30) - any where you have used this domain, the column
automatically gets modified - so you don't have to find all the places
where you used it and alter that table.
There is no CREATE DOMAIN in Oracle AFAIK.

In answer to the original question, no, you cannot create scalar types
in Oracle.


Reply With Quote
  #25  
Old   
William Robertson
 
Posts: n/a

Default Re: user defined data type: does they exist ? - 01-27-2008 , 05:43 PM



On Jan 27, 1:00 am, Michael Austin <maus... (AT) firstdbasource (DOT) com> wrote:
Quote:
Mark D Powell wrote:
On Jan 18, 5:39 am, alberto.rol... (AT) gmail (DOT) com wrote:
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!

If you object type consists of a single varchar2 value why do you need
an object at all?

My professional opinion based on experience and common sense is that
objects do not belong stored in a relational database but should be
created and manipulated in the application layer.

Adhoc query tools and end users do not relate to stored objects.

You can however sometimes use objects to advantage in PL/SQL code that
manipulates data.

HTH -- Mark D Powell --

Mark,

I believe the TYPE could also represent objects with a single definition:

CREATE TYPE demo_typ1 AS OBJECT (a1 VARCHAR2(20));

CREATE TABLE demo_tab1 (b1 NUMBER, b2 demo_typ1);

This is more analogous to the Oracle Rdb (formerly DEC Rdb) DOMAIN. You
can create a domain of a specified name, size and default values... for
example:

SQL> CREATE DOMAIN ADDRESS_DATA2_DOM VARCHAR2(20) DEFAULT NULL;

SQL> CREATE TABLE X (ADDRESS_2 ADDRESS_DATA2_DOM);
SQL> CREATE TABLE y (ADDRESS_1 ADDRESS_DATA2_DOM);

And columns ADDRESS_1 and ADDRESS_2 will assume the characteristics and
default value from domain address_data2_dom.

Any where you need a 20 character data type you can use this domain.
Cool thing is that when you then alter the domain to be - say
varchar2(30) - any where you have used this domain, the column
automatically gets modified - so you don't have to find all the places
where you used it and alter that table.
There is no CREATE DOMAIN in Oracle AFAIK.

In answer to the original question, no, you cannot create scalar types
in Oracle.


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

Default Re: user defined data type: does they exist ? - 01-28-2008 , 02:48 PM



On Jan 26, 8:00*pm, Michael Austin <maus... (AT) firstdbasource (DOT) com> wrote:
Quote:
Mark D Powell wrote:
On Jan 18, 5:39 am, alberto.rol... (AT) gmail (DOT) com wrote:
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!

If you object type consists of a single varchar2 value why do you need
an object at all?

My professional opinion based on experience and common sense is that
objects do not belong stored in a relational database but should be
created and manipulated in the application layer.

Adhoc query tools and end users do not relate to stored objects.

You can however sometimes use objects to advantage in PL/SQL code that
manipulates data.

HTH -- Mark D Powell --

Mark,

I believe the TYPE could also represent objects with a single definition:

CREATE TYPE demo_typ1 AS OBJECT (a1 VARCHAR2(20));

CREATE TABLE demo_tab1 (b1 NUMBER, b2 demo_typ1);

This is more analogous to the Oracle Rdb (formerly DEC Rdb) DOMAIN. You
can create a domain of a specified name, size and default values... for
example:

SQL> CREATE DOMAIN ADDRESS_DATA2_DOM VARCHAR2(20) DEFAULT NULL;

SQL> CREATE TABLE X (ADDRESS_2 ADDRESS_DATA2_DOM);
SQL> CREATE TABLE y (ADDRESS_1 ADDRESS_DATA2_DOM);

And columns ADDRESS_1 and ADDRESS_2 will assume the characteristics and
default value from domain address_data2_dom.

Any where you need a 20 character data type you can use this domain.
Cool thing is that when you then alter the domain to be - say
varchar2(30) - any where you have used this domain, the column
automatically gets modified - so you don't have to find all the places
where you used it and alter that table.- Hide quoted text -

- Show quoted text -
Michael, yes they can but the point of my reply was to state that such
definitions do not belong being used as column definitions in
permanent tables. If the type is varchar2(20) just use varchar2(20).

Adhoc query tool, ODBC, etc... just do not deal well with stored
objects in realtional databases.

HTH -- Mark D Powell --


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

Default Re: user defined data type: does they exist ? - 01-28-2008 , 02:48 PM



On Jan 26, 8:00*pm, Michael Austin <maus... (AT) firstdbasource (DOT) com> wrote:
Quote:
Mark D Powell wrote:
On Jan 18, 5:39 am, alberto.rol... (AT) gmail (DOT) com wrote:
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!

If you object type consists of a single varchar2 value why do you need
an object at all?

My professional opinion based on experience and common sense is that
objects do not belong stored in a relational database but should be
created and manipulated in the application layer.

Adhoc query tools and end users do not relate to stored objects.

You can however sometimes use objects to advantage in PL/SQL code that
manipulates data.

HTH -- Mark D Powell --

Mark,

I believe the TYPE could also represent objects with a single definition:

CREATE TYPE demo_typ1 AS OBJECT (a1 VARCHAR2(20));

CREATE TABLE demo_tab1 (b1 NUMBER, b2 demo_typ1);

This is more analogous to the Oracle Rdb (formerly DEC Rdb) DOMAIN. You
can create a domain of a specified name, size and default values... for
example:

SQL> CREATE DOMAIN ADDRESS_DATA2_DOM VARCHAR2(20) DEFAULT NULL;

SQL> CREATE TABLE X (ADDRESS_2 ADDRESS_DATA2_DOM);
SQL> CREATE TABLE y (ADDRESS_1 ADDRESS_DATA2_DOM);

And columns ADDRESS_1 and ADDRESS_2 will assume the characteristics and
default value from domain address_data2_dom.

Any where you need a 20 character data type you can use this domain.
Cool thing is that when you then alter the domain to be - say
varchar2(30) - any where you have used this domain, the column
automatically gets modified - so you don't have to find all the places
where you used it and alter that table.- Hide quoted text -

- Show quoted text -
Michael, yes they can but the point of my reply was to state that such
definitions do not belong being used as column definitions in
permanent tables. If the type is varchar2(20) just use varchar2(20).

Adhoc query tool, ODBC, etc... just do not deal well with stored
objects in realtional databases.

HTH -- Mark D Powell --


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

Default Re: user defined data type: does they exist ? - 01-28-2008 , 02:48 PM



On Jan 26, 8:00*pm, Michael Austin <maus... (AT) firstdbasource (DOT) com> wrote:
Quote:
Mark D Powell wrote:
On Jan 18, 5:39 am, alberto.rol... (AT) gmail (DOT) com wrote:
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!

If you object type consists of a single varchar2 value why do you need
an object at all?

My professional opinion based on experience and common sense is that
objects do not belong stored in a relational database but should be
created and manipulated in the application layer.

Adhoc query tools and end users do not relate to stored objects.

You can however sometimes use objects to advantage in PL/SQL code that
manipulates data.

HTH -- Mark D Powell --

Mark,

I believe the TYPE could also represent objects with a single definition:

CREATE TYPE demo_typ1 AS OBJECT (a1 VARCHAR2(20));

CREATE TABLE demo_tab1 (b1 NUMBER, b2 demo_typ1);

This is more analogous to the Oracle Rdb (formerly DEC Rdb) DOMAIN. You
can create a domain of a specified name, size and default values... for
example:

SQL> CREATE DOMAIN ADDRESS_DATA2_DOM VARCHAR2(20) DEFAULT NULL;

SQL> CREATE TABLE X (ADDRESS_2 ADDRESS_DATA2_DOM);
SQL> CREATE TABLE y (ADDRESS_1 ADDRESS_DATA2_DOM);

And columns ADDRESS_1 and ADDRESS_2 will assume the characteristics and
default value from domain address_data2_dom.

Any where you need a 20 character data type you can use this domain.
Cool thing is that when you then alter the domain to be - say
varchar2(30) - any where you have used this domain, the column
automatically gets modified - so you don't have to find all the places
where you used it and alter that table.- Hide quoted text -

- Show quoted text -
Michael, yes they can but the point of my reply was to state that such
definitions do not belong being used as column definitions in
permanent tables. If the type is varchar2(20) just use varchar2(20).

Adhoc query tool, ODBC, etc... just do not deal well with stored
objects in realtional databases.

HTH -- Mark D Powell --


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

Default Re: user defined data type: does they exist ? - 01-28-2008 , 02:48 PM



On Jan 26, 8:00*pm, Michael Austin <maus... (AT) firstdbasource (DOT) com> wrote:
Quote:
Mark D Powell wrote:
On Jan 18, 5:39 am, alberto.rol... (AT) gmail (DOT) com wrote:
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!

If you object type consists of a single varchar2 value why do you need
an object at all?

My professional opinion based on experience and common sense is that
objects do not belong stored in a relational database but should be
created and manipulated in the application layer.

Adhoc query tools and end users do not relate to stored objects.

You can however sometimes use objects to advantage in PL/SQL code that
manipulates data.

HTH -- Mark D Powell --

Mark,

I believe the TYPE could also represent objects with a single definition:

CREATE TYPE demo_typ1 AS OBJECT (a1 VARCHAR2(20));

CREATE TABLE demo_tab1 (b1 NUMBER, b2 demo_typ1);

This is more analogous to the Oracle Rdb (formerly DEC Rdb) DOMAIN. You
can create a domain of a specified name, size and default values... for
example:

SQL> CREATE DOMAIN ADDRESS_DATA2_DOM VARCHAR2(20) DEFAULT NULL;

SQL> CREATE TABLE X (ADDRESS_2 ADDRESS_DATA2_DOM);
SQL> CREATE TABLE y (ADDRESS_1 ADDRESS_DATA2_DOM);

And columns ADDRESS_1 and ADDRESS_2 will assume the characteristics and
default value from domain address_data2_dom.

Any where you need a 20 character data type you can use this domain.
Cool thing is that when you then alter the domain to be - say
varchar2(30) - any where you have used this domain, the column
automatically gets modified - so you don't have to find all the places
where you used it and alter that table.- Hide quoted text -

- Show quoted text -
Michael, yes they can but the point of my reply was to state that such
definitions do not belong being used as column definitions in
permanent tables. If the type is varchar2(20) just use varchar2(20).

Adhoc query tool, ODBC, etc... just do not deal well with stored
objects in realtional databases.

HTH -- Mark D Powell --


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.