Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Using LIKE with IN on an expression
On Jan 26, 4:04 pm, "Grant" <grant.Collinswo..._at_eds.com> wrote:
> Hi,
>
> The following Statement:
>
> WHERE x.field LIKE (IN(%MyCommadelimetedValue%))
>
> Is that thecorrect syntax to perfom a comparison on values brought in
> from a selection combo box? (Iam assuming that Oracle is able to
> perform such an operation)
>
> Thanks
>
> Grant
Hi,
You are looking for something like what is below?
SQL> create table t0126(c varchar2(10));
Table created.
SQL> insert into t0126 values('foo');
1 row created.
SQL> insert into t0126 values('bar');
1 row created.
SQL> insert into t0126 values('redsox');
1 row created.
SQL> insert into t0126 values('redfoo');
1 row created.
SQL> commit;
Commit complete.
You want something like ...
SQL> select from t0126 where c like(in('%red%','%foo%')); select from t0126 where c like(in('%red%'))
*
ERROR at line 1:
ORA-00936: missing expression
SQL> One way would be to pass the selected values in the combo box to a procedure which builds a dynamic OR'd WHERE clause. Read up on dynamic SQL at tahiti.oracle.com, paying close attention to using bind variables whenever you build a string like this.
http://download-east.oracle.com/docs/cd/B19306_01/appdev.102/b14261/dynamic.htm#i13130
HTH, Steve Received on Fri Jan 26 2007 - 18:09:06 CST
![]() |
![]() |