我看了下,有例子啊。 我看了下看它的定义: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 ------------------------------------------------------------
这个就是第二条路径了:Calling a Procedure Using an Expression of an Object Type: ExampleThe 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 456The 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;PRINT x;X -------------------------------- Warehouse 234
这里讲得很清楚。
只有routine_clause这条路径的例子,没有object_access_expression的例子,请给出call object_access_expression的示例,谢谢!
我看了下看它的定义: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
------------------------------------------------------------
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 456The 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;PRINT x;X
--------------------------------
Warehouse 234
但我感觉这个是第一条路径吧.
第二条路径中有 table_alias 和 ( expr )这两条路径,能举个例子吗?
非常感谢