This forum is currently locked. You can't register or post questions at this time. (read more)

Question about article of "ObjectTypes"

All posts relating to Oracle PL/SQL development.

Moderator: Tim...

Guest

Question about article of "ObjectTypes"

Postby Guest » Mon Nov 01, 2004 6:09 pm

I tried the example at http://www.oracle-base.com/articles/8i/object-types.php. I got an error when I tried to do:
SELECT p.id,
p.person.first_name,
p.person.getAge() age
FROM people p;

The error message is:
ORA-06571: Function GETAGE does not guarantee not to update database

How to avoid this error message?

Tim...
Site Admin
Posts: 18437
Joined: Mon Nov 01, 2004 5:56 pm
Location: England, UK
Contact:

RE: Question about article of

Postby Tim... » Mon Nov 01, 2004 6:09 pm

My guess is you are using an earlier version of 8i, not 8.1.7. In the later versions of 8i the need to specify purity levels was removed. Try this:

CREATE OR REPLACE TYPE PersonObj AS OBJECT (
first_name VARCHAR2(50),
last_name VARCHAR2(50),
date_of_birth DATE,
MEMBER FUNCTION getAge RETURN NUMBER,
PRAGMA RESTRICT REFERENCES(getAge, WNDS)
);
/

This states that the member function getAge Writes No Databased State.

Check out the discussion of purity levels:

http://otn.oracle.com/docs/products/ora ... tm#2064466
http://otn.oracle.com/docs/products/ora ... tm#1014698
Tim...
Oracle ACE Director
Oracle ACE of the Year 2006 - Oracle Magazine Editors Choice Awards
OakTable Member
OCP DBA 7.3, 8, 8i, 9i, 10g, 11g
OCP Advanced PL/SQL Developer
Oracle Database: SQL Certified Expert
My website: http://www.oracle-base.com
My blog: http://www.oracle-base.com/blog


Return to “Oracle SQL and PL/SQL Development”

Who is online

Users browsing this forum: No registered users and 4 guests

cron