Re: PL/SQL conditions being ignored (query for a children's hospital)

From: Ken Denny <ken_at_kendenny.com>
Date: Sat, 30 Mar 2002 15:35:44 GMT
Message-ID: <Xns91E16CDF97206kendenny_at_65.82.44.7>


lx29000_at_yahoo.com (Brad Campbell) wrote in news:743366d0.0203290925.1783a159_at_posting.google.com:

> I'm a struggling query writer who's trying to figure out how to do a
> word search on long data type. The query executes without error.
> However, it doesn't recognize my nested if that's supposed to further
> limit which ID's are to be inserted into a temp table. For example, I
> don't want it to insert into that table any ID's where the text
> contains the string 'CODE%N' (where % is a wildcard). But it does get
> inserted despite the nested if that has a not condition for this
> (among others). Any help would be greatly appreciated. Thanks. Brad
> C.
>
> Below is my code:

The way you have it here the insert will be bypassed ONLY if the text contains all the string. If any one of the strings are missing from the text the row will be inserted. You probably mean to replace the 'OR's with 'AND's.

> IF((instr(rpt,'NORMAL',-1) = 0) OR (instr(rpt,'NO EVIDENCE',-1) = 0)
> OR (rpt NOT LIKE '%CODE%N%') OR (instr(rpt,'NO FRACTURE',-1) = 0))
> then
> insert into research_list(result_Addendum_id, result_value)
> values (prc.result_addendum_id, rpt);
> end if;

Using 'OR' if any one of these strings is missing from the text, the row is inserted.

-- 
Ken Denny
http://www.kendenny.com/

"No matter what happens, somebody will find a way to take it too 
seriously" - Dave Barry 
Received on Sat Mar 30 2002 - 16:35:44 CET

Original text of this message