Subject | RE: [firebird-support] Evaluate "empty" string |
---|---|
Author | bogdan mordicom |
Post date | 2017-08-17T05:50:22Z |
This is also possible
If (coalesce(terminal, '') <> '') then
Regards
Bogdan
From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com]
Sent: Wednesday, August 16, 2017 6:39 PM
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] Evaluate "empty" string
May be this :
if (terminal<>'') and ( not (terminal is null)) then
do something
With best regards
Michel
Le Mercredi 16 août 2017 18h20, "Mark Rotteveel mark@... [firebird-support]" <firebird-support@yahoogroups.com> a écrit :
On 16-8-2017 17:53, Jorge Andres Brugger jorge.brugger@...
[firebird-support] wrote:
> Hello all.An empty string is not null, so even though
> I need to evaluate if one SP varchar parameter is "not empty". I´m using:
> if (((CHAR_LENGTH(trim(terminal))>0) or (terminal is not null)) then <do
> something>.
> If I send '' (empty string) as parameter content, the expression
> evaluates to true (I´m expecting to get a false).
> What am I doing wrong?
(CHAR_LENGTH(trim(terminal))>0) might be false, (terminal is not null)
is true, so the IF evaluates to true and is executed.
Maybe you meant AND instead of OR?
--
Mark Rotteveel