Problem with Oracle 8 and Objects

From: Fabienne Dubos <fdubos_at_France.Sun.Com>
Date: Mon, 20 Jul 1998 08:35:09 +0200
Message-ID: <35B2E51D.6452_at_France.Sun.Com>



Hello,

        I'm working on Oracle 8, and I've some problems :

  1. I've installed Oracle v8.0.4 When I ask for options : select * from v$option;
		They say to me :
			. partition
			. objects : FALSE

		How I can install these functionnalities on Oracle 8.0.4 ???



	Then for the moment ... I'm back on Oracle 8.0.3 !!!

	And Here have some problems with objects and varrays :

		2. I can't insert datas in a table created with a 
		new object type, just look at my file :

--

  • Type creation
    --
    CREATE or REPLACE TYPE adresse_t AS OBJECT ( numero number(4), rue varchar2(40), ville varchar2(40), codep number(5) ) /
    ---> Everything's good !!!


    --
  • New creation of a type, with a method
    --
    CREATE or REPLACE TYPE personne_t AS OBJECT ( nom varchar2(20), prenom varchar2(20), adresse adresse_t, daten DATE,

        MEMBER FUNCTION age return NUMBER,

        ORDER MEMBER FUNCTION map_fonct return INTEGER,

        PRAGMA RESTRICT_REFERENCES (age, RNDS, WNDS, WNPS) )
/

CREATE or REPLACE TYPE BODY personne_t AS

        MEMBER FUNCTION age RETURN NUMBER IS
                compteur        NUMBER;

        begin
                compteur := 5;
                return compteur;
        end;

--
--
        MAP MEMBER FUNCTION map_fonct  RETURN INTEGER IS

-- ORDER MEMBER FUNCTION map_fonct RETURN INTEGER IS
begin return 0; end;

end;
--
--

/
---> Everything's good !!!


--
--
  • I create table !!!
    --

DROP TABLE employes
/
CREATE TABLE employes
(

        num_emp         number(4) PRIMARY KEY,
        personne        personne_t,
        num_dep         number(3)

)
/  

-----> Everything's good !!!


  • I fill up the table
    --
    -----> Everything's good !!!

INSERT into employes VALUES

(       1234,           -- num_emp
        personne_t (    -- personne
                'dupond',       -- nom
                'jean',         -- prenom
                adresse_t       -- adresse
                        (3,                     -- numero
                        'rue de la liberte',    -- rue
                        'aswded',               -- ville
                        74568                   -- codep
                        ),
                '01-Jan-1900'   -- daten
                   ),
        123             -- num_dep

)  

/  

--

  • I tried to update a record
    --
    UPDATE employes SET personne.adresse.codep=98764 WHERE num_emp=1234 /

 -----> Everything's BAD !!!


	Oracle says to me : coulum personne.adresse.codep 
	is unknown 

		WHAT'S WRONG IN MY EXAMPLE ?????






		3. Unfortunaltely .. I've tried to use varray !!!
		(What a bad day !!!)



--

  • Creation of a new type
    --
    CREATE or REPLACE TYPE telephone_t AS OBJECT ( numero NUMBER(8) ) /
    -----> Everything's good !!!

--
--

CREATE or REPLACE TYPE g_telephone AS VARRAY(2)

        OF telephone_t
/
--
--
-----> Everything's good !!!


DROP TABLE annuaire
/
--

CREATE TABLE annuaire
(

        nom     varchar2(10),
        prenom  varchar2(10),
        tel_num g_telephone

)
/
--
--
-----> Everything's good !!!

INSERT INTO annuaire values
(

        'dupond',       -- nom
        'jean',         -- prenom
        g_telephone (
                telephone_t (
                        1234,5678
                            )    
                    )

)
/

 -----> Everything's BAD !!!


	Oracle says to me : I can't insert datas of that type
	Then I've tried


INSERT INTO annuaire values
(

        'dupond',       -- nom
        'jean',         -- prenom
        g_telephone (
                        1234,5678
                    )

)
/

        Same .. thing


		Can you help me PLEASE :-<<<<<<
	=============================================

	I just ask to you an example of those new kind
	of types .. which works (I haven't found it in Oracle
	documentation .... 





With lot of Thanks ... Received on Mon Jul 20 1998 - 08:35:09 CEST

Original text of this message