Subject | RE: [firebird-support] Re: Expressions |
---|---|
Author | Namık Kemal KARASU |
Post date | 2005-07-20T16:57:21Z |
I try this on char fields. And get error message 'Expression evaluation
doesn't supported.'
So I though that I can not run any expression.
Thanks for help.
_____
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of Adam
Sent: Wednesday, July 20, 2005 2:35 AM
To: firebird-support@yahoogroups.com
Subject: [firebird-support] Re: Expressions
--- In firebird-support@yahoogroups.com, "nk_karasu" <nkkarasu@g...>
wrote:
some form of number (integer / float / numeric / etc) because you are
calling it FieldsTotal.
That procedure will work if both AField and AnOtherField are exactly
the same type, otherwise it will not work. Some development tools are
clever enough to automatically cast the fields as the right type, but
AFAIK Firebird will assume the field type will be the same as AField,
which means is AnOtherField is not of that type you will have
problems.
In that case, you need to pick the lowest denominator, so if AField
is an integer and AnOtherField is a float, then you will need to cast
AField as a float to do the math.
eg:
SELECT (CAST(AField as Float) + AnOtherField) AS FieldTotals ....
You could certainly do it inside a SP as well, but you would have the
same problems trying to add a float to an integer and store it in an
integer field.
Hope that helps
Adam
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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+security&w3=Computer+technical+support&w4=Computer+training&w5=F
ree+computer+technical+support&c=5&s=138&.sig=77sbeaNS_CB99ND1NpQ02w>
support
Computer
<http://groups.yahoo.com/gads?t=ms&k=Computer+security&w1=Technical+support&
w2=Computer+security&w3=Computer+technical+support&w4=Computer+training&w5=F
ree+computer+technical+support&c=5&s=138&.sig=h-vpfglcVDyMom6ZGRj-AA>
security
Computer
<http://groups.yahoo.com/gads?t=ms&k=Computer+technical+support&w1=Technical
+support&w2=Computer+security&w3=Computer+technical+support&w4=Computer+trai
ning&w5=Free+computer+technical+support&c=5&s=138&.sig=0PtYe-giICy1KkECNuG2E
A> technical support
Computer
<http://groups.yahoo.com/gads?t=ms&k=Computer+training&w1=Technical+support&
w2=Computer+security&w3=Computer+technical+support&w4=Computer+training&w5=F
ree+computer+technical+support&c=5&s=138&.sig=psUjUcHSklN7Uvu_cJch-g>
training
Free
<http://groups.yahoo.com/gads?t=ms&k=Free+computer+technical+support&w1=Tech
nical+support&w2=Computer+security&w3=Computer+technical+support&w4=Computer
+training&w5=Free+computer+technical+support&c=5&s=138&.sig=isTctikpuewr3b60
7bkoUA> computer 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]
doesn't supported.'
So I though that I can not run any expression.
Thanks for help.
_____
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of Adam
Sent: Wednesday, July 20, 2005 2:35 AM
To: firebird-support@yahoogroups.com
Subject: [firebird-support] Re: Expressions
--- In firebird-support@yahoogroups.com, "nk_karasu" <nkkarasu@g...>
wrote:
> Hi.Stored
>
> The query below dosn't work.
>
> "SELECT (AField + AnOtherField) AS FieldsTotal FROM FieldsTable"
>
> Is there a way to run queries includes expressions in ib/fb(Like
> procedures etc.).Looking at your query, I am guessing AField and AnOtherField are both
>
> Thanks for help...
some form of number (integer / float / numeric / etc) because you are
calling it FieldsTotal.
That procedure will work if both AField and AnOtherField are exactly
the same type, otherwise it will not work. Some development tools are
clever enough to automatically cast the fields as the right type, but
AFAIK Firebird will assume the field type will be the same as AField,
which means is AnOtherField is not of that type you will have
problems.
In that case, you need to pick the lowest denominator, so if AField
is an integer and AnOtherField is a float, then you will need to cast
AField as a float to do the math.
eg:
SELECT (CAST(AField as Float) + AnOtherField) AS FieldTotals ....
You could certainly do it inside a SP as well, but you would have the
same problems trying to add a float to an integer and store it in an
integer field.
Hope that helps
Adam
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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+security&w3=Computer+technical+support&w4=Computer+training&w5=F
ree+computer+technical+support&c=5&s=138&.sig=77sbeaNS_CB99ND1NpQ02w>
support
Computer
<http://groups.yahoo.com/gads?t=ms&k=Computer+security&w1=Technical+support&
w2=Computer+security&w3=Computer+technical+support&w4=Computer+training&w5=F
ree+computer+technical+support&c=5&s=138&.sig=h-vpfglcVDyMom6ZGRj-AA>
security
Computer
<http://groups.yahoo.com/gads?t=ms&k=Computer+technical+support&w1=Technical
+support&w2=Computer+security&w3=Computer+technical+support&w4=Computer+trai
ning&w5=Free+computer+technical+support&c=5&s=138&.sig=0PtYe-giICy1KkECNuG2E
A> technical support
Computer
<http://groups.yahoo.com/gads?t=ms&k=Computer+training&w1=Technical+support&
w2=Computer+security&w3=Computer+technical+support&w4=Computer+training&w5=F
ree+computer+technical+support&c=5&s=138&.sig=psUjUcHSklN7Uvu_cJch-g>
training
Free
<http://groups.yahoo.com/gads?t=ms&k=Free+computer+technical+support&w1=Tech
nical+support&w2=Computer+security&w3=Computer+technical+support&w4=Computer
+training&w5=Free+computer+technical+support&c=5&s=138&.sig=isTctikpuewr3b60
7bkoUA> computer 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]