Static Method : type body « Object Oriented « Oracle PL/SQL Tutorial






SQL>
SQL> CREATE OR REPLACE TYPE zip_code AS OBJECT
  2  (five_digit_code NUMBER,
  3   four_digit_code NUMBER,
  4   STATIC FUNCTION getZip(zip_in zip_code) RETURN zip_Code
  5  );
  6  /

Type created.

SQL> CREATE OR REPLACE TYPE BODY zip_code AS
  2    STATIC FUNCTION getZip(zip_in zip_code) RETURN zip_code
  3    IS
  4      v_zip zip_code;
  5    BEGIN
  6      v_zip :=zip_code(null,null);
  7      v_zip.five_digit_code :=zip_in.five_digit_code;
  8      v_zip.four_digit_code :=zip_in.four_digit_code;
  9      RETURN (v_zip);
 10     END;
 11  END;
 12  /

Type body created.

SQL>








32.4.type body
32.4.1.Create type body
32.4.2.Type with method
32.4.3.Static Method
32.4.4.Implement a function in type body
32.4.5.Create toString function for a type
32.4.6.Object table
32.4.7.Type with order function
32.4.8.Type with member procedure