-
Hi! All
I am not clear about object relational database. Can I store a class inside a database? Which means the data and associated methods to works on the data.
Regards
There Nothing You cannot Do, The problem is HOW.
-
oracles object terminology is a bit different
classes are called types type defination is stored in the data dictionary that means classes are stored in the data dictonary
you should create a column/table of that object type to actually store data.
heres an example......
create type adddresstype
.........
..............
create table employee
name varchar2(20),
address addresstype.........
hth
-
What I meant was can we also store methods to works on the class in the database(I classical OO Classes store data and metyhods together)?
There Nothing You cannot Do, The problem is HOW.
-
of course yes you can store them
CREATE OR REPLACE TYPE Dummy AS OBJECT (
f1 NUMBER,
f2 NUMBER,
MEMBER PROCEDURE Method1(x IN VARCHAR2),
MEMBER FUNCTION Method2 RETURN DATE
);
/
an object is created with attributes as f1 & f2 and 2 member functions.
-- Create the type body.
CREATE OR REPLACE TYPE BODY Dummy AS
MEMBER PROCEDURE Method1(x IN VARCHAR2) IS
BEGIN
NULL;
END Method1;
MEMBER FUNCTION Method2 RETURN DATE IS
BEGIN
RETURN SYSDATE;
END Method2;
END;
/
COLUMN object_name FORMAT a20
SELECT object_name, object_type, status
FROM user_objects
WHERE object_name = 'DUMMY';
i hope i answer your question this time......
[Edited by hrishy on 04-11-2001 at 04:56 AM]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|