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

From: Brad Campbell <lx29000_at_yahoo.com>
Date: 1 Apr 2002 07:18:42 -0800
Message-ID: <743366d0.0204010718.669ef957_at_posting.google.com>


lx29000_at_yahoo.com (Brad Campbell) wrote in message 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:
>
> --------

>...

> IF(rpt LIKE '%CERVICAL%FRACTURE%' or rpt LIKE '%CERVICAL%SUBLUXATION%'
> or rpt LIKE '%ATLANTO%OCCIPITAL DISSOCIATION%' or instr(rpt,'CHANCE
> FRACTURE')>0 or instr(rpt,'PELVIC FRACTURE')>0 or instr(rpt,'CHILD
> ABUSE')>0 or instr(rpt,'SHAKEN BABY')>0) THEN
> 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))
>...
> ---------------

Thanks to all those of you who responded. After posting this message, I stumbled on the concept of short-circuit evalution. I assumed PL/SQL would evaluate all OR'ed conditions. Apparently, that's viewed as a feature. I'm not sure I agree. I've sinced fixed the query by addressing that.

Brad C. Received on Mon Apr 01 2002 - 17:18:42 CEST

Original text of this message