PLS-00588: unqualified instance attribute references allowed only in member methods : Type Body « Object Oriented Database « Oracle PL / SQL






PLS-00588: unqualified instance attribute references allowed only in member methods

 

SQL> CREATE OR REPLACE TYPE StaticDemo AS OBJECT (
  2    attribute1 NUMBER,
  3    attribute2 NUMBER,
  4
  5    STATIC PROCEDURE Static1,
  6
  7    STATIC FUNCTION Static2(p_Obj IN StaticDemo)
  8      RETURN StaticDemo
  9  );
 10  /

Type created.

SQL> show errors
No errors.
SQL>
SQL> CREATE OR REPLACE TYPE BODY StaticDemo AS
  2    STATIC PROCEDURE Static1 IS
  3    BEGIN
  4      attribute1 := 7;
  5      DBMS_OUTPUT.PUT_LINE(attribute2);
  6    END Static1;
  7
  8    STATIC FUNCTION Static2(p_Obj IN StaticDemo)
  9      RETURN StaticDemo IS
 10      myResult StaticDemo := StaticDemo(0, 0);
 11    BEGIN
 12      myResult.attribute1 := p_Obj.attribute1 + 1;
 13      myResult.attribute2 := p_Obj.attribute2 - 1;
 14      RETURN myResult;
 15    END Static2;
 16  END;
 17  /

Warning: Type Body created with compilation errors.

SQL> show errors
Errors for TYPE BODY STATICDEMO:

LINE/COL ERROR
-------- -----------------------------------------------------------------
4/5      PL/SQL: Statement ignored
4/5      PLS-00588: unqualified instance attribute references allowed only
         in member methods

5/5      PL/SQL: Statement ignored
5/26     PLS-00588: unqualified instance attribute references allowed only
         in member methods

SQL>
SQL>
SQL>

 








Related examples in the same category

1.Create type body
2.Create user type with map
3.Reference type member function in select statement
4.type attribute accesser
5.Address object
6.Define getter function for object
7.Define ToString method for object type