Subject | RE: [firebird-support] Re: The New command in triggers |
---|---|
Author | Graeme Edwards |
Post date | 2006-02-16T03:28:44Z |
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of Helen Borrie
Sent: Thursday, 16 February 2006 2:02 PM
To: firebird-support@yahoogroups.com
Subject: RE: [firebird-support] Re: The New command in triggers
At 10:31 AM 16/02/2006, you wrote:
result will be true if the condition is met and false otherwise. An
UNKNOWN result in Firebird resolves to a result of False, not NULL.
In many expressions, the result of a calculation involving NULL and
value will return NULL, representing an UNKNOWN result.
doesn't exist) and you meant that both tests were predicates for IF,
then, in both cases, they will evaluate to False, not NULL.
This was badly phrased, I actually meant expressions that evaluated to Null,
False, True etc but
having looked at the Firebird Null guide I now understand this.
The predicates IS NULL and IS NOT NULL exist. Both return True or
False to the engine but there is no output result of True or False
returned to the caller.
However, to partly answer your question, Boolean evaluation works
from left to right and from inner conditions to outer conditions.
false and can never be "NULL". The flow of execution proceeds
directly from the result of the test, viz.
If (New.ID=Old.ID) then .. Whatever
I understand this a bit better now also having read the null guide. Would it
be correct to
say that if an expression evaluates to NULL because one of the values being
compared
is NULL, then the outcome is effectively treated as equivalent to False in
that the then part
is ignored and execution continues with the else part. If there is no else
part, then I would assume
that the next statement after the then would be executed?
Firebird doesn't support a Boolean type, per se. You can predicate a
result for further reference by declaring and setting a variable to
store something you will later use as a reference to the result of your
test.
declare variable IsTrue smallint = 0;
....
If (New.ID=Old.ID) then
begin
IsTrue = 1;
...
...
if (IsTrue = 0) then .. Whatever
...
end
If you want to return a Boolean result from a stored procedure,
define an output variable of your preferred type for Boolean use,
assign a value to it according to your IF (..) result and return that.
./heLen
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Visit http://firebird.sourceforge.net and click the Resources item
on the main (top) menu. Try Knowledgebase and FAQ links !
Also search the knowledgebases at http://www.ibphoenix.com
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SPONSORED LINKS
Technical
<http://groups.yahoo.com/gads?t=ms&k=Technical+support&w1=Technical+support&
w2=Computer+technical+support&w3=Compaq+computer+technical+support&w4=Compaq
+technical+support&w5=Hewlett+packard+technical+support&w6=Microsoft+technic
al+support&c=6&s=196&.sig=-XIO8GxY6hqd3NaD5WSEyw> support
Computer
<http://groups.yahoo.com/gads?t=ms&k=Computer+technical+support&w1=Technical
+support&w2=Computer+technical+support&w3=Compaq+computer+technical+support&
w4=Compaq+technical+support&w5=Hewlett+packard+technical+support&w6=Microsof
t+technical+support&c=6&s=196&.sig=B29J78SYXnNTjjMFBMznqA> technical
support
Compaq
<http://groups.yahoo.com/gads?t=ms&k=Compaq+computer+technical+support&w1=Te
chnical+support&w2=Computer+technical+support&w3=Compaq+computer+technical+s
upport&w4=Compaq+technical+support&w5=Hewlett+packard+technical+support&w6=M
icrosoft+technical+support&c=6&s=196&.sig=7_je1A94xs82CFXUjEqA6g> computer
technical support
Compaq
<http://groups.yahoo.com/gads?t=ms&k=Compaq+technical+support&w1=Technical+s
upport&w2=Computer+technical+support&w3=Compaq+computer+technical+support&w4
=Compaq+technical+support&w5=Hewlett+packard+technical+support&w6=Microsoft+
technical+support&c=6&s=196&.sig=2zMAuRCo5cJrVBr1Bxa3_w> technical support
Hewlett
<http://groups.yahoo.com/gads?t=ms&k=Hewlett+packard+technical+support&w1=Te
chnical+support&w2=Computer+technical+support&w3=Compaq+computer+technical+s
upport&w4=Compaq+technical+support&w5=Hewlett+packard+technical+support&w6=M
icrosoft+technical+support&c=6&s=196&.sig=_ytYU7aXb57AVaeUfmvLcA> packard
technical support
Microsoft
<http://groups.yahoo.com/gads?t=ms&k=Microsoft+technical+support&w1=Technica
l+support&w2=Computer+technical+support&w3=Compaq+computer+technical+support
&w4=Compaq+technical+support&w5=Hewlett+packard+technical+support&w6=Microso
ft+technical+support&c=6&s=196&.sig=4hRo6NXYavRAbTkaYec5Lw> technical
support
_____
YAHOO! GROUPS LINKS
* Visit your group "firebird-support
<http://groups.yahoo.com/group/firebird-support> " on the web.
* To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com
<mailto:firebird-support-unsubscribe@yahoogroups.com?subject=Unsubscribe>
* Your use of Yahoo! Groups is subject to the Yahoo!
<http://docs.yahoo.com/info/terms/> Terms of Service.
_____
[Non-text portions of this message have been removed]
[mailto:firebird-support@yahoogroups.com] On Behalf Of Helen Borrie
Sent: Thursday, 16 February 2006 2:02 PM
To: firebird-support@yahoogroups.com
Subject: RE: [firebird-support] Re: The New command in triggers
At 10:31 AM 16/02/2006, you wrote:
>I have some further questions based on Milan's advice since I have not comeBut you might have heard of UNKNOWN? In Boolean evaluation, the
>across the concept of NULL in Boolean evaluation before.
result will be true if the condition is met and false otherwise. An
UNKNOWN result in Firebird resolves to a result of False, not NULL.
In many expressions, the result of a calculation involving NULL and
value will return NULL, representing an UNKNOWN result.
>Assuming you meant to say "a value" rather than NOTNULL (which
>If NULL=NOTNULL evaluates to NULL does
>
>NULL<>NOTNULL also evaluate to NULL?
doesn't exist) and you meant that both tests were predicates for IF,
then, in both cases, they will evaluate to False, not NULL.
>Does NULL within any Boolean expression such asThere is no such syntax and there are no predicates named as False and True.
>
>IF ((Null OR False) and True) make the whole expression evaluate to NULL?
This was badly phrased, I actually meant expressions that evaluated to Null,
False, True etc but
having looked at the Firebird Null guide I now understand this.
The predicates IS NULL and IS NOT NULL exist. Both return True or
False to the engine but there is no output result of True or False
returned to the caller.
However, to partly answer your question, Boolean evaluation works
from left to right and from inner conditions to outer conditions.
>Is it valid to test the result of a Boolean expression for NULL as well asNo. For one thing, the result of the inner test is either true or
>true and false?
>
>Eg.
>
>If (New.ID=Old.ID) is Null then .. Whatever
false and can never be "NULL". The flow of execution proceeds
directly from the result of the test, viz.
If (New.ID=Old.ID) then .. Whatever
I understand this a bit better now also having read the null guide. Would it
be correct to
say that if an expression evaluates to NULL because one of the values being
compared
is NULL, then the outcome is effectively treated as equivalent to False in
that the then part
is ignored and execution continues with the else part. If there is no else
part, then I would assume
that the next statement after the then would be executed?
Firebird doesn't support a Boolean type, per se. You can predicate a
result for further reference by declaring and setting a variable to
store something you will later use as a reference to the result of your
test.
declare variable IsTrue smallint = 0;
....
If (New.ID=Old.ID) then
begin
IsTrue = 1;
...
...
if (IsTrue = 0) then .. Whatever
...
end
If you want to return a Boolean result from a stored procedure,
define an output variable of your preferred type for Boolean use,
assign a value to it according to your IF (..) result and return that.
./heLen
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Visit http://firebird.sourceforge.net and click the Resources item
on the main (top) menu. Try Knowledgebase and FAQ links !
Also search the knowledgebases at http://www.ibphoenix.com
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SPONSORED LINKS
Technical
<http://groups.yahoo.com/gads?t=ms&k=Technical+support&w1=Technical+support&
w2=Computer+technical+support&w3=Compaq+computer+technical+support&w4=Compaq
+technical+support&w5=Hewlett+packard+technical+support&w6=Microsoft+technic
al+support&c=6&s=196&.sig=-XIO8GxY6hqd3NaD5WSEyw> support
Computer
<http://groups.yahoo.com/gads?t=ms&k=Computer+technical+support&w1=Technical
+support&w2=Computer+technical+support&w3=Compaq+computer+technical+support&
w4=Compaq+technical+support&w5=Hewlett+packard+technical+support&w6=Microsof
t+technical+support&c=6&s=196&.sig=B29J78SYXnNTjjMFBMznqA> technical
support
Compaq
<http://groups.yahoo.com/gads?t=ms&k=Compaq+computer+technical+support&w1=Te
chnical+support&w2=Computer+technical+support&w3=Compaq+computer+technical+s
upport&w4=Compaq+technical+support&w5=Hewlett+packard+technical+support&w6=M
icrosoft+technical+support&c=6&s=196&.sig=7_je1A94xs82CFXUjEqA6g> computer
technical support
Compaq
<http://groups.yahoo.com/gads?t=ms&k=Compaq+technical+support&w1=Technical+s
upport&w2=Computer+technical+support&w3=Compaq+computer+technical+support&w4
=Compaq+technical+support&w5=Hewlett+packard+technical+support&w6=Microsoft+
technical+support&c=6&s=196&.sig=2zMAuRCo5cJrVBr1Bxa3_w> technical support
Hewlett
<http://groups.yahoo.com/gads?t=ms&k=Hewlett+packard+technical+support&w1=Te
chnical+support&w2=Computer+technical+support&w3=Compaq+computer+technical+s
upport&w4=Compaq+technical+support&w5=Hewlett+packard+technical+support&w6=M
icrosoft+technical+support&c=6&s=196&.sig=_ytYU7aXb57AVaeUfmvLcA> packard
technical support
Microsoft
<http://groups.yahoo.com/gads?t=ms&k=Microsoft+technical+support&w1=Technica
l+support&w2=Computer+technical+support&w3=Compaq+computer+technical+support
&w4=Compaq+technical+support&w5=Hewlett+packard+technical+support&w6=Microso
ft+technical+support&c=6&s=196&.sig=4hRo6NXYavRAbTkaYec5Lw> technical
support
_____
YAHOO! GROUPS LINKS
* Visit your group "firebird-support
<http://groups.yahoo.com/group/firebird-support> " on the web.
* To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com
<mailto:firebird-support-unsubscribe@yahoogroups.com?subject=Unsubscribe>
* Your use of Yahoo! Groups is subject to the Yahoo!
<http://docs.yahoo.com/info/terms/> Terms of Service.
_____
[Non-text portions of this message have been removed]