Type with member procedure
SQL>
SQL> CREATE TABLE emp
2 (id VARCHAR2(10) NOT NULL,
3 course VARCHAR2(10),
4 year VARCHAR2(4),
5 PRIMARY KEY (id));
Table created.
SQL> CREATE OR REPLACE TYPE empType AS OBJECT
2 (id VARCHAR2(10),
3 course VARCHAR2(20),
4 year VARCHAR2(4),
5 MEMBER PROCEDURE Delete_emp )
6 /
Type created.
SQL>
SQL> CREATE OR REPLACE TYPE BODY empType AS
2 MEMBER PROCEDURE
3 Delete_emp IS
4 BEGIN
5 DELETE FROM emp
6 WHERE emp.id = self.id;
7 END Delete_emp;
8 END;
9 /
Type body created.
SQL> drop table emp;
Table dropped.
Related examples in the same category