Re: user defined data type: does they exist ?
Date: Fri, 18 Jan 2008 12:06:07 GMT
Message-ID: <PC0kj.23795$W73.15189@trnddc04>
<alberto.roller_at_gmail.com> wrote in message news:09f4925a-e73e-43f7-a65b-9ae15b7215dc_at_e25g2000prg.googlegroups.com...
> 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
Received on Fri Jan 18 2008 - 06:06:07 CST