A type with member function:
SQL> CREATE TYPE t_emp AS OBJECT (
2 id INTEGER,
3 name VARCHAR2(15),
4 description VARCHAR2(22),
5 sal NUMBER(5, 2),
6 hiredate DATE,
7 MEMBER FUNCTION get_hire_date RETURN DATE
8 );
9 /
Type created.
SQL>
SQL> CREATE TYPE BODY t_emp AS
2 MEMBER FUNCTION get_hire_date RETURN DATE IS
3 v_date DATE;
4 BEGIN
5 SELECT hiredate INTO v_date FROM dual;
6 RETURN v_date;
7 END;
8 END;
9 /
Type body created.
SQL>
CREATE PUBLIC SYNONYM t_pub_emp FOR t_emp;
Home »
Oracle »
PL/SQL »
Oracle »
PL/SQL »
Object Types:
- Creating Object Types
- A type with member function:
- Using DESCRIBE to Get Information on Object Types
- Using Object Types in Database Tables
- Retrieve an individual column object from a table
- Call method from type
- UPDATE/DELETE row based on custom data type
- Object Tables
- VALUE() selects a row from an object table.
- UPDATE Object Table
- DELETE rows from Object Table
- Object table abased on nested types
- Object Identifiers and Object References
- REF type for an object reference
- Retrieve the actual objects stored in an object reference using the DEREF() function,
- Comparing Object Values
Related: