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: Bind variable as search pattern

Re: Bind variable as search pattern

From: Jim Kennedy <kennedy-family_at_attbi.com>
Date: Wed, 25 Sep 2002 01:33:38 GMT
Message-ID: <Sn8k9.578283$UU1.94261@sccrnsc03>


Try:

 create or replace procedure test5
 (p1 IN varchar2)
 IS
   v_counter number;
   v_prop prop%rowtype;
   CURSOR block_cursor IS
   select * from my_table where upper(location) like '%'||p1||'%';

 begin

 v_counter:=0;

  open block_cursor;
  loop
  fetch block_cursor into v_prop;
  exit when block_cursor%rowcount>5 or

           block_cursor%notfound;
  end loop;

 close block_cursor;
 end test5;

"Tong Li" <tongli_at_unagi.cis.upenn.edu> wrote in message news:amqhnh$fc$1_at_netnews.upenn.edu...
> Hello There:
>
> I am trying use bind variable as search pattern in cursor,
> but I couldn't get result set.
> I think there is something wrong with the like statement.
> Any hint, please?
> Thanks in advance.
>
> Tina
>
>
> Below is my code.
> ----------------------------------------
> create or replace procedure test5
> (p1 IN varchar2)
> IS
> v_counter number;
> v_prop prop%rowtype;
> CURSOR block_cursor IS
> select * from my_table where upper(location) like '%:p1%';
>
> begin
>
> v_counter:=0;
>
> open block_cursor;
> loop
> fetch block_cursor into v_prop;
> exit when block_cursor%rowcount>5 or
> block_cursor%notfound;
> end loop;
>
> close block_cursor;
> end test5;
>
>
>
>
>
>
>
>
Received on Tue Sep 24 2002 - 20:33:38 CDT

Original text of this message

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