[Zope] Zope-help

Dieter Maurer dieter@handshake.de
Thu, 6 Jul 2000 23:23:16 +0200 (CEST)


Bruno Nana writes:
 > select *
 > from iekunde
 > <!--#if "alphabet!='alle'" -->
 > where (substring(firma,1,1)=substring(<!--#var alphabet -->,1,1) or
 > substring(firma,1,1) > substring(<!--#var alphabet -->,1,1)) and
 > (substring(firma,1,1)=substring(<!--#var alphabet -->,3,1) or
 > substring(firma,1,1) < substring(<!--#var alphabet -->,3,1))
 > <!--#/if -->
 > 
 > And the error is this:
 > 
 > Error Type: Error
 > Error Value: Error processing select * from iekunde where
 > (substring(firma,1,1)=substring(UuZ,1,1) or substring(firma,1,1) >
 > substring(UuZ,1,1)) and (substring(firma,1,1)=substring(UuZ,3,1) or
 > substring(firma,1,1) < substring(UuZ,3,1)) Invalid column name 'UuZ'.
 > Invalid column name 'UuZ'. Invalid column name 'UuZ'. Invalid column name
 > 'UuZ'.
 > 
 > That mean that the operator ">" can only compare two number.

It means that "UuZ" is interpreted as a *column name*, i.e. as
a field in your database and not as a string. This is
because, it is not enclosed in '...'.
Such a column does not exist; therefore, the invalid column name
errors.

Instead of "<dtml-var alphabet>" you should use
"<dtml-sqlvar alphabet type=string>".
It does represent the constant string value correctly.


Dieter