Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: help on "the" operator

Re: help on "the" operator

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Thu, 07 Mar 2002 09:28:30 -0800
Message-ID: <F001.0042221D.20020307092830@fatcity.com>

The "the()" operator, which changed to the "table()" operator in 8.1 takes a single value that has to be a nested table or varray as its operand.

What you are casting is the single row and single column that you select from dual, but that single item is the result of casting a result set into a nested table or varray.

In fact in Oracle 9, you can get rid of the select from dual, and for a function returning the varray/nested table write:

select * from table(function_name);

or, if TABX is a table with a column COLX

select colx, function_name(colx)
from TABX;

You can play similar games with 8.1, but the SQL looks messier. You may then
need to wrap one level of SQL inside an
inline view to convert the whole thing into a flattened table.

Jonathan Lewis
http://www.jlcomp.demon.co.uk

Next Seminar - UK, April 3rd - 5th
http://www.jlcomp.demon.co.uk/seminar.html

Host to The Co-Operative Oracle Users' FAQ http://www.jlcomp.demon.co.uk/faq/ind_faq.html

Author of:
Practical Oracle 8i: Building Efficient Databases

-----Original Message-----
To: Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com> Date: 07 March 2002 12:23

Hi Gurus!
if any function which returns the collection type , to show that collection object in tabular format we use "the" operator with dual table which has one row and one column like followings: select * from the
(select cast( <<function name l(parameters )>> as <<return obeject
type>> ) from dual )

my question is can i use any real table in my existing database other than "Dual" in above SQL .
Does "the" operator looks for single records in inner SQL ( as returning records from dual does mean that single record and single column )
i means to say when i use real table then it gives the error   "ORA-01427 : single row subquery returns more than one row " i hope the operator looks for only one record . If it is that then can access the result wot i want by using real table because the parameters which r being passed in function are columns from the table wot i want to use ?
looking for help.........
thanx in advance

Shishir Kumar Mishra
Agni Software (P) Ltd.,
Bangalore-560055, India
www.agnisoft.com

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Jonathan Lewis
  INET: jonathan_at_jlcomp.demon.co.uk

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L

(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).
Received on Thu Mar 07 2002 - 11:28:30 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US