Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Select multiple rows from DUAL ?
<andy.malakov_at_gmail.com> wrote in message news:1105127135.680598.193460_at_f14g2000cwb.googlegroups.com...
> 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
>
The simple way which Serge hints to:
ORA92> create type myarray as table of number; 2 /
Type created.
ORA92> select * from table(myarray(1,2,3,4));
COLUMN_VALUE
1 2 3 4
HTH
Anurag
Received on Fri Jan 07 2005 - 17:21:28 CST
![]() |
![]() |