Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2003
    Location
    Woking
    Posts
    107

    Unanswered: Cast and Multiset

    Hi,

    I just wanted to know what are these functions (CAST and MULTISET).
    I saw an SQL which had these functions in them.
    Any help would be of great use.

    Thanks
    nn

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1

    Re: Cast and Multiset

    Originally posted by NoviceNo1
    Hi,

    I just wanted to know what are these functions (CAST and MULTISET).
    I saw an SQL which had these functions in them.
    Any help would be of great use.

    Thanks
    It's all to do with Object Types. CAST tells Oracle the required datatype for the result of an expression, and MULTISET tells Oracle to put the multiple rows returned by a SELECT statement into a single collection object.

    So you could see this:

    CREATE TYPE emp_t IS OBJECT
    ( empno NUMBER, ename VARCHAR2(10) );

    CREATE TYPE emp_tab_t IS TABLE OF emp_t;

    SELECT CAST( MULTISET( SELECT empno, ename FROM emp) AS emp_tab_t ) emptab
    FROM DUAL;

    The result set consists of 1 row, with datatype emp_tab_t, which contains the data for all employees.

    Get more details here:

    http://technet.oracle.com/docs/produ...5a.htm#1017232

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •