Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Valorize parameter to get alla records
On Aug 22, 8:47 am, Fab FaRa <fabrizio.far..._at_email.it> wrote:
> Hi to all!
> I'm executing a query from a my application using paramters for the
> WHERE clausole.
>
> It's possibile force the value of one parameters to work like a jolly
> (*) and get alla the records?
> In this way i can use the same query for a selective selectione or an
> "all recorsd" selection
>
> example:
>
> Select name from mytable where name = :MyName;
>
> Thanks and sorry for may very bad english.
The usual trick is
select name
from mytable
where name like :Myname||'%';
Just leave Myname blank and you will get everything
The wildcard for multiple characters is '%' This can easily be looked in the sql reference manual at http://tahiti.oracle.com and you shouldn't ask for it here.
-- Sybrand Bakker Senior Oracle DBAReceived on Wed Aug 22 2007 - 04:04:10 CDT