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: querying varray

Re: querying varray

From: malcolm arnold <malcolmarnold_at_gmail.com>
Date: Mon, 28 Nov 2005 16:21:34 +0000
Message-ID: <fc3bda600511280821y31db8ec6o@mail.gmail.com>


Hi Geraldine,

You can do it like this:

SQL>select id from mytab t where exists (select null from table(t.numlist) where column_value = 90);

        ID


         2

Hope that helps.

Malcolm.

On 28/11/05, geraldine_2_at_comcast.net <geraldine_2_at_comcast.net> wrote:
> Hi,
> I'm having trouble writing a query to return the record containing a particular element in the varray. In the example below, I would like to search for the id that contains 90 in myvarray. The query should return id=2. How can I do that?
>
> thanks.
>
>
> create or replace type myvarray as varray(5) of number;
> /
>
>
> create table mytab (
> id number,
> numlist myvarray
> )
> /
>
> insert into mytab values (1,myvarray(10,20,30,40,50));
> insert into mytab values (2,myvarray(60,70,80,90,100));
>
> SQL> select * from mytab;
> ID NUMLIST
> ---------- ------------------------------
> 1 MYVARRAY(10, 20, 30, 40, 50)
> 2 MYVARRAY(60, 70, 80, 90, 100)
>
>
> geraldine
> --
> http://www.freelists.org/webpage/oracle-l
>
>
>

--
http://www.freelists.org/webpage/oracle-l
Received on Mon Nov 28 2005 - 10:23:42 CST

Original text of this message

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