Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: String comparisons in PL/SQL

Re: String comparisons in PL/SQL

From: Zbigniew Sliwa <zibi_at_at_hotmail.com>
Date: Fri, 25 Aug 2000 08:15:14 GMT
Message-ID: <mWpp5.15206$Yl4.349482@news.tpnet.pl>

Alan,

Use IS NULL instead of = ''.
= '' will always return FALSE.

AND (t.notes LIKE '%' || inNotes ||'%' OR (inNotes IS NULL AND t.notes IS NULL))



Regards,

Zbigniew Sliwa
Oracle Programmer
Poland
email: zibi_at_at_yahoo.com

alan napisa³(a) w wiadomo¶ci: <39a5cbbd.34173468_at_news.pacbell.net>...
>Hopefully this question will be a simple one for somebody, but I am
>not that body.
>
>For the life of me I am not able to test whether an input string into
>a stored procedure is the empty string
>
>I figured that it would be simple but the following code always tests
>false...
>
>
>AND (t.notes LIKE '%' || inNotes ||'%' OR (inNotes = '' AND t.notes IS
>NULL))
>
>BTW, they are 2 single quotes just before the second 'AND'
>
>I need to test this as I am doing pattern matching on table columns
>that may contain nulls. So my statement is basically saying
>
>Find rows where column 'notes' contains the string variable 'inNotes'
>or, if 'notes' is null, then return the column if inNotes is blank (ie
>nothing was entered in this field in the input page).
>
>Perhaps my explanation is a little more long winded that necessary,
>but I didn't want to miss the solution for want of explaining the
>problem.
>
>TIA
>
>alan
>
Received on Fri Aug 25 2000 - 03:15:14 CDT

Original text of this message

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