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

Home -> Community -> Usenet -> c.d.o.server -> Re: Select multiple rows from DUAL ?

Re: Select multiple rows from DUAL ?

From: Serge Rielau <srielau_at_ca.ibm.com>
Date: Fri, 07 Jan 2005 16:06:29 -0500
Message-ID: <348bttF47ib4gU1@individual.net>


andy.malakov_at_gmail.com wrote:
> I need to synchronize in-memory cache of objects with database. One of
> the things I have to check is that each loaded object still exists in
> the database. To do that I perform queries like:
>
> SELECT pk FROM sometable WHERE pk IN (...);
>
> After that I subtract result set from the set of loaded primary keys to
> get list of deleted objects that have to be purged from memory.
>
> Problem: Query that I use returns set of existing objects, but in my
> application deletes are not very frequent. In other words, usually
> result set consist of the same set of primary keys that I use as query
> input. I would like to change that query to return only set of
> *non-existing* primary keys. I need something like the following
> (wrong) SQL:
>
> SELECT (10, 20, 30 )
> MINUS
> SELECT pk FROM sometable WHERE PK IN (10,20,30);
>
> I cannot put input set into some table because query must allow
> concurrent use. I would also like to avoid using a stored procedure
> unless it could be very generic.
> Any other ideas will be great!
>
> Thanks,
> Andy
>

I think you can turn an VARRAY into a TABLE.. That should do it. Something like:
SELECT x FROM TABLE(VARRAY(???)) AS X(x) MINUS.... Cheers
Serge Received on Fri Jan 07 2005 - 15:06:29 CST

Original text of this message

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