Calling a Procedure Using an Expression of an Object Type: Example
The following examples show how call a procedure by using an expression of an object type in the CALL statement. The example uses the warehouse_typ object type in the order entry sample schema OE:
ALTER TYPE warehouse_typ
ADD MEMBER FUNCTION ret_name
RETURN VARCHAR2
CASCADE;
CREATE OR REPLACE TYPE BODY warehouse_typ
AS MEMBER FUNCTION ret_name
RETURN VARCHAR2
IS
BEGIN
RETURN self.warehouse_name;
END;
END;
/
VARIABLE x VARCHAR2(25);
CALL warehouse_typ(456, 'Warehouse 456', 2236).ret_name()
INTO :x;
PRINT x;
X
--------------------------------
Warehouse 456
The next example shows how to use an external function to achieve the same thing:
CREATE OR REPLACE FUNCTION ret_warehouse_typ(x warehouse_typ)
RETURN warehouse_typ
IS
BEGIN
RETURN x;
END;
/
CALL ret_warehouse_typ(warehouse_typ(234, 'Warehouse 234',
2235)).ret_name()
INTO :x;
我看了下,有例子啊。
我看了下看它的定义:If you have an expression of an object type, you can use this form of expression to call a routine defined within the type.好像就是用来调用有自定义类型的那种函数或过程吧。
你看文档中间的链接:
------------------------------------------------------------
See Also:
"Object Access Expressions " for syntax and semantics of this form of expression, and "Calling a Procedure Using an Expression of an Object Type: Example" for an example of calling a routine using an expression of an object type
------------------------------------------------------------