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

Home -> Community -> Usenet -> c.d.o.server -> Re: Equivalent of User-Defined Datatypes in Oracle?

Re: Equivalent of User-Defined Datatypes in Oracle?

From: David <darussell_at_msn.com>
Date: Sun, 2 Aug 1998 01:45:24 +0100
Message-ID: <uJ3YG7av9GA.91@upnetnews03>


Oracle8 provides full support for types via the objects option :

For example :

CREATE OR REPLACE TYPE RoomObj AS OBJECT (

  ID           NUMBER(5),
  building     VARCHAR2(15),

  room_number NUMBER(4),
  number_seats NUMBER(4),
  description VARCHAR2(50),
  MEMBER PROCEDURE Print,
  MAP MEMBER FUNCTION ReturnID RETURN NUMBER );
/
CREATE OR REPLACE TYPE BODY RoomObj AS
  MEMBER PROCEDURE Print IS
  BEGIN
    DBMS_OUTPUT.PUT('Room ID:' || ID || ' is located in ');
    DBMS_OUTPUT.PUT(building || ', room ' || room_number);
    DBMS_OUTPUT.PUT(', and has ' || number_seats || ' seats.');
    DBMS_OUTPUT.NEW_LINE;

  END Print;
  MAP MEMBER FUNCTION ReturnID RETURN NUMBER IS   BEGIN
    RETURN SELF.ID;
  END ReturnID;
END;
/

CREATE TABLE rooms OF RoomObj;

Regards
David Russell

Scott C. wrote in message <6psndc$9cf$1_at_camel0.mindspring.com>...
>I'm looking to port several apps from MS/SQL Server to Oracle 8 and one of
>the roadblocks (and I expect many) is there doesn't seem to be the
>equivalent of user-defined datatypes in Oracle 8.x.
>
>I've looked at "subtypes" but it doesn't seem like I can use them in table
>creation which is the most critical part for my apps as every table
>definition in the existing MS/SQL Server environment uses them.
>
>I find it hard to believe that Oracle in 1998 wouldn't have a feature that
>seems so basic.
>
>
Received on Sat Aug 01 1998 - 19:45:24 CDT

Original text of this message

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