Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: object problem

Re: object problem

From: Thomas J. Kyte <tkyte_at_us.oracle.com>
Date: 2000/06/25
Message-ID: <8j5opg$9j$1@nnrp1.deja.com>#1/1

In article <0Rv45.17416$7I1.351296_at_news1.rdc2.on.home.com>,   "Francis Wong" <wongfrancis_at_home.com> wrote:
> I define a object type like the following:
>
> create type address_objtyp as object (
> addr1 varchar2(20),
> addr2 varchar2(20),
> ...
> ...
> )
>
> and then define a table somewhat like this:
>
> create table customer(
> cust_name varchar2(30),
> ....
> ....
> address address_objtyp,
> ....
> ....
>
> )
>
> What is the command syntax try to set the the columns address.addr1
 and
> address.addr2 not null?
>
>

here is one way:

ops$tkyte_at_8i> create type address_obj_type as object   2 ( addr1 int,
  3 addr2 int
  4 )
  5 /

Type created.

ops$tkyte_at_8i>
ops$tkyte_at_8i> create table customer

  2  (       cust_id int,
  3          address address_obj_type,
  4          constraint addr_not_null
                    check ( address.addr1 is not null
                            and
                            address.addr2 is not null )
  5 )
  6 /

Table created.

--
Thomas Kyte (tkyte_at_us.oracle.com) Oracle Service Industries
Howtos and such: http://osi.oracle.com/~tkyte/index.html
Oracle Magazine: http://www.oracle.com/oramag
Opinions are mine and do not necessarily reflect those of Oracle Corp


Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Sun Jun 25 2000 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US