This script demonstrates complex objects
SQL>
SQL>
SQL> CREATE OR REPLACE TYPE PriceType AS OBJECT (
2 discount_rate NUMBER(10,4),
3 price NUMBER(10,2),
4
5 MEMBER FUNCTION discount_price RETURN NUMBER)
6 INSTANTIABLE
7 FINAL;
8 /
Type created.
SQL>
SQL>
SQL> CREATE OR REPLACE TYPE inventory_obj AS OBJECT (
2 item_id NUMBER(10),
3 num_in_stock NUMBER(10),
4 reorder_status VARCHAR2(20),
5 price REF PriceType);
6 /
Type created.
SQL>
Related examples in the same category