Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Objects with Oracle 9.i
Hello helping hands,
I try to create objects under a ORACLE 9.i Database.
The problem is, that I will have a reference between the object (MENSCH) and
the object (BUECHER)
When I wanna do the attachet statement for creating the objects and the
related tables I will get the object at his self but not the details like
variables and member functions.
Please let me know what I'm doing wrong with the object MENSCH and BUECHER.
Many thanks
Peter
Statement:
CREATE type buch as objekct
(
lfdnr number,
titel varchar2(50),
wert number
);
commit;
create type buchliste as table of buch;
commit;
CREATE TYPE MENSCH AS OBJECT
(
NAME VARCHAR2(255),
VNAME VARCHAR2(255),
STRASSE VARCHAR2(255),
ORT VARCHAR2(255),
PLZ VARCHAR2(255),
GEBDAT VARCHAR2(255),
buecher buchliste,
MEMBER FUNCTION G_ALTER RETURN NUMBER,
PRAGMA RESTRICT_REFERENCES( G_ALTER, WNDS, WNPS ),
MEMBER FUNCTION G_ANSCHRIFT RETURN VARCHAR2,
PRAGMA RESTRICT_REFERENCES( G_ANSCHRIFT, WNDS, WNPS ),
MEMBER FUNCTION G_BUCHZAHL RETURN NUMBER,
PRAGMA RESTRICT_REFERENCES( G_BUCHZAHL, WNDS, WNPS )
);
commit;
CREATE TYPE BODY MENSCH IS
MEMBER FUNCTION g_alter RETURN NUMBER IS
BEGIN
return floor(months_between(sysdate, gebdat)/12);
END;
MEMBER FUNCTION G_ANSCHRIFT RETURN VARCHAR2 IS
anschrift varchar2(300) :=' ';
BEGIN
IF geschl ='M' then
anschrift :='Herrn'||char(10)||chr13;
else
anschrift = 'Frau'||char(10)||chr13;
END IF;
anschrift:= anschrift||vname||' '||name||char(10)||chr13;
anschrift:= anschrift||plz||' '||ort;
return anschrift;
END;
MEMBER FUNCTION G_BUCHZAHL RETURN NUMBER IS
BEGIN
return buecher.count;
END;
END;
commit;
create table buecher store as buch_tab;
commit; Received on Wed Apr 03 2002 - 03:33:56 CST
![]() |
![]() |