.. _对象引用函数(Oracle):

对象引用函数
~~~~~~~~~~~~~

.. _VALUE(Oracle):

VALUE
###########

**用法**

.. code::

    VALUE(correlation_variable)


.. figure:: images/object-reference-value.png
   :align: center

**功能**

VALUE将对象表的一行相关联的关联变量(表别名)作为参数，并返回存储在对象表中的对象实例。

对象实例的类型与对象表的类型相同。


**例子**

.. code::

    CREATE TYPE person_t AS OBJECT (name varchar2(100), ssn number);
    CREATE TABLE persons OF person_t;
    INSERT INTO persons VALUES (person_t('Bob', 1234));
    INSERT INTO persons VALUES (person_t('Joe', 2345));
    INSERT INTO persons VALUES (person_t('Tom', 5678));
    SELECT value(t) FROM persons t;
    value
    ------------
    (Bob,1234)
    (Joe,2345)
    (Tom,5678)
    (3 rows)

