Re: SELECT... INTO... problem
Date: 2000/05/25
Message-ID: <sirvh29no189_at_corp.supernews.com>#1/1
<pete_karanikas_at_hotmail.com> wrote in message
news:8gkanm$uv$1_at_nnrp1.deja.com...
> TurkBear,
> Actually, you're right. The p_count is getting set. I'm trying to
> write a procedure that will print out an error if there are no objects
> with the desired object_name found... ie. p_count=0.
> It goes a little "something" like this:
>
> CREATE or REPLACE PROCEDURE countit
> object_search_string varchar2(25) default NULL;
> is
> p_count integer;
> BEGIN
> select count(a.object_name) into p_count
> from user_objects a,
> where a.object_name like '|| object_search_string ||';
>
> IF p_count = 0 THEN
> htp.p( 'Your search returned no results, try again' );
> END IF;
>
> ...
>
> END;
Shouldn't your LIKE have percentage signs (wildcards)?:
select count(a.object_name) into p_count
from user_objects a,
where a.object_name like '%object_search_string%';
Or maybe declare a second variable:
d_object_search_string varchar2(27) := '%'||object_search_string||'%';
And then use d_object_search_string in your select-into?
-Matt Received on Thu May 25 2000 - 00:00:00 CEST